Class: OpengraphTransporter::Browser

Inherits:
Object
  • Object
show all
Defined in:
lib/opengraph_transporter/browser.rb

Constant Summary collapse

MAX_TRANSLATION_PAGE_LIMIT =
30
DEFAULT_PRIMARY_LOCALE =
"en_US"

Class Method Summary collapse

Class Method Details

.exportObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/opengraph_transporter/browser.rb', line 9

def export
  begin 
    Watir.driver = :webdriver
    @browser = Watir::Browser.new :firefox
    @page_index_counter = 0
    @translation_count_index = 0
    @translation = Base.translation
    @translation_arr = @translation [:dst_translation_arr].clone
    

    if @translation[:primary_locale].nil?
      primary_locale = DEFAULT_PRIMARY_LOCALE
    end

    developer_translations_home_uri = "https://www.facebook.com/translations/admin/browse.php?search=&sloc=#{primary_locale}&aloc=#{@translation[:app_locale]}&app=#{@translation[:destination_application_id]}"
    @browser.goto developer_translations_home_uri
    GracefulQuit.enable
    parse_translation_rows

  rescue Exception => e
    say("An error occurred when generating automated browser, do you have FireFox installed? \n\n error: #{e}.")
    exit
  end
end