I have a problem: I make a new group at my network webseit and then I will to delete it. When I make it - I see a new window (JavaScript) and I can nothing doing. How can I whrite my code if I see this window?
I use Watir-WebDriver in Cucumber and I work with Google Chrome.
Not sure if this helps 100% but in my Ruby code I require "dialogs.rb"
and then call killjspopup(browser)
right after loading a new page into Watir::Browser. This file contains:
def killjspopup(browser)
# don't return anything for alert
browser.execute_script("window.alert = function() {}")
# return some string for prompt to simulate user entering it
#browser.execute_script("window.prompt = function() {return 'my name'}")
# return null for prompt to simulate clicking Cancel
browser.execute_script("window.prompt = function() {return null}")
# return true for confirm to simulate clicking OK
browser.execute_script("window.confirm = function() {return true}")
# return false for confirm to simulate clicking Cancel
#browser.execute_script("window.confirm = function() {return false}")
end
您是否尝试过Watir-Webdriver页面上列出的解决方案 - http://watirwebdriver.com/javascript-dialogs/ ?
browser.alert.ok
More details at: http://watirwebdriver.com/javascript-dialogs/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.