How you can refresh a page in Watir-Webdrive?
Asked Answered
P

1

11

How can I refresh a page using watir-webdrive? I tried what they are saying here: http://watirwebdriver.com/sending-special-keys/ , but no luck.

browser.send_keys :f5

Any other suggestions? Thanks

Principate answered 31/8, 2012 at 12:52 Comment(0)
P
20

You can do:

browser.refresh

See docs.

Pelton answered 31/8, 2012 at 13:14 Comment(8)
i tried , still get the error: [remote server] file:///C:/Users/user/AppData/Local/Temp/webdriver-profile201208 31-5896-8q5ft0/extensions/[email protected]/components/command_processor.j s:10198:in unknown': Modal dialog present (Selenium::WebDriver::Error::Unhandle dAlertError) from C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.1/lib/watir -webdriver/browser.rb:110:in refresh'Principate
The error message is claiming a modal dialog is present. Is there a modal dialog present? If so, you have to close it first. If you manually went to a page with a modal dialog, I do not believe you can refresh the page without closing the dialog first.Pelton
I kill it with this: def callPopupKillerFF $pid = Process.create(:app_name => 'ruby clickPopupsFF.rb', :creation_flags => Process::DETACHED_PROCESS).process_id endPrincipate
I have never used that method for closing popups, so not really sure how it works. Do you have a test page that you are having problems refreshing?Pelton
I need refreshing, because when I add something to my cart, the new item isn't automatically put it (refreshed) in my cart. So i need to refresh the page somehow to check if the new item exists in my cart.Principate
That is fine. As an alternative, you could get the browser's url and navigate there again. Beyond that, unless you can provide a page that reproduces the problem, I do not know how else to help. Sorry.Pelton
I'm glad that this URL isn't dynamic .So i will use your suggestion and ... If you don't mind, can you tell me what you are using to kill javascript pop-up windows?Principate
Take a look at this page for handling popups watirwebdriver.com/javascript-dialogs.Pelton

© 2022 - 2024 — McMap. All rights reserved.