safariwatir

How to use watir-webdriver to wait for page load

谁都会走 提交于 2019-12-20 09:37:34
问题 Using watir-webdriver, how do I wait for a page to load after I click a link? At the moment I am using: sleep n But this is not ideal as the page response varies so much. Is there a way to test whether the page is ready or whether there is a certain element in the page? I understand in the normal Watir gem there is Watir::Waiter.wait_until or something similar, but I don't see this in the webdriver version. 回答1: I don't know if they're the best way, but this is how I'm handling this for

Save screenshot with Watir

*爱你&永不变心* 提交于 2019-12-05 03:40:54
问题 I am using Watir with Ruby on Rails. I need to save screenshots of couple of pages using Watir. I have managed to get the page that I want to open to show in a browser, but cannot save the screenshot yet. Here's my code: @browser = Watir::Safari.new folios_screenshot_path = Rails.root.join('screenshots/') @page = Page.find(5) cur_url = root_url + 'pages/' + @page.id.to_s @browser.goto cur_url @browser.div(:id => "page").wait_until_present @browser.driver.save_screenshot(pagess_screenshot_path

Save screenshot with Watir

女生的网名这么多〃 提交于 2019-12-03 17:29:34
I am using Watir with Ruby on Rails. I need to save screenshots of couple of pages using Watir. I have managed to get the page that I want to open to show in a browser, but cannot save the screenshot yet. Here's my code: @browser = Watir::Safari.new folios_screenshot_path = Rails.root.join('screenshots/') @page = Page.find(5) cur_url = root_url + 'pages/' + @page.id.to_s @browser.goto cur_url @browser.div(:id => "page").wait_until_present @browser.driver.save_screenshot(pagess_screenshot_path + '/' + @page.id.to_s + '.png') @browser.close In the page that I load, there's a div element with id

watir-webdriver wait for page load

丶灬走出姿态 提交于 2019-12-02 19:15:48
Using watir-webdriver , how do i wait for a page to load after i click a link? At the moment i am doing: sleep n But this is not ideal as the page response varies so much. Is there a method to test whether the page is ready or whether there is a certain element in the page. I understand in the normal watir gem there is Watir::Waiter.wait_until or something similar, but I cannot see this in the webdriver version. marc I don't know if they're the best way, but this is how I'm handling this for waiting for updating div to clear: while browser.div(:id=>"updating_div").visible? do sleep 1 end This