watir

Can't connect to Tor-Firefox via Watir

我只是一个虾纸丫 提交于 2019-12-01 21:08:49
I am having issues connecting to Tor via Ruby - Watir webdriver. I use the Tor Browser Bundle. The problem is that when I try to connect via Watir (Selenium) I cannot seem to open Tor instead of regular Firefox. Looking at similar issues I've tried the following: require 'watir-webdriver' profile = Selenium::WebDriver::Firefox::Profile.new profile['network.proxy.socks'] = '127.0.0.1' #the proxy tor uses profile['network.proxy.socks_port'] = 9150 #I cannot use 9050, 9150 works when I use Tor profile['network.proxy.type'] = 1 browser = Watir::Browser.new :firefox, :profile => profile browser

What's the difference between `visible?` and `present?`?

假装没事ソ 提交于 2019-12-01 20:47:21
From the Watir API, I've derived two assertions (which of course might not be correct): I can use exists? if I simply want to verify that the element is in the HTML. I don't care if it's visible or not. I can use visible? if I want to be able to see it on the page. So, when do I use present? ? It seems to me that I could answer my own question by saying: I can use present? if I want to be able to see it on the page, but I don't want it to be in the HTML. So, if I write something on the screen using a marker pen, would that be present? ? (Sorry if I seem to be irreverent.) So - another way to

Check tag classes with watir?

我的未来我决定 提交于 2019-12-01 18:14:15
问题 I have a div that changes based on if the form was submitted correctly or not. I wanted to know if it's possible to check a specific element for a class or not? Starting out the element looks like this. <div id="myerrortest" class="input text"></div> If the input isn't correct add the error class. <div id="myerrortest" class="input text error"></div> 回答1: Try this: browser.div(:id => "myerrortest").class_name More information: http://watir.github.com/watir-webdriver/doc/Watir/HTMLElement.html

Check tag classes with watir?

微笑、不失礼 提交于 2019-12-01 17:45:59
I have a div that changes based on if the form was submitted correctly or not. I wanted to know if it's possible to check a specific element for a class or not? Starting out the element looks like this. <div id="myerrortest" class="input text"></div> If the input isn't correct add the error class. <div id="myerrortest" class="input text error"></div> Željko Filipin Try this: browser.div(:id => "myerrortest").class_name More information: http://watir.github.com/watir-webdriver/doc/Watir/HTMLElement.html#class_name-instance_method Another alternative would be to just see if the div with class

Watir with webdriver, proxy, Firefox

放肆的年华 提交于 2019-12-01 14:45:30
I am able to use watir-webdriver with IE, but I would prefer to use Firefox. Problem: I need a proxy. By googling around, I found some code snippets, but I am not able to put all them together. This is what I produced up to now, please let me know what am I missing: require 'watir-webdriver' FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("network.proxy.http", "proxy.myplace.com"); profile.setPreference("network.proxy.http_port", 8080); WebDriver driver = new FirefoxDriver(profile); browser = Watir::Browser.new :firefox browser.goto( "http://www.google.com/" ) I get this

How to deal with a page which fails to load and continue testing in Watir-Webdriver

怎甘沉沦 提交于 2019-12-01 12:45:49
I have looked for answer on other questions but I can't find one. My problem is that I have a number of results that I need to test but my script keeps failing when I hit an Url that doesn't load a page. The following Url does not load. When this Url does not load I want to continue with my testing. http://www.mycounciltax.org.uk/results?postcode=WC1N1DF&search=Search I have tried to use: begin Timeout::timeout(30) do //enter part that is hanging end end However the script just exits. Below is the full script that I am using. The script will time out and exit on.... browser.goto "http://www

Can a watir browser object be re-used in a later Ruby process?

≡放荡痞女 提交于 2019-12-01 10:40:36
So let's say pretty often a script runs that opens a browser and does web things: require 'watir-webdriver' $browser = Watir::Browser.new(:firefox, :profile => "botmode") => #<Watir::Browser:0x7fc97b06f558 url="about:blank" title="about:blank"> It could end gracefully with a browser.close, or it could crash sooner and leave behind the memory-hungry Firefox process, unnoticed until they accumulate and slow the server to a crawl. My question is twofold: What is a good practice to ensure that even in case of script failure anywhere leading to immediate error exit, the subprocess will always get

Chrome on remote webdriver (via Grid) failed to start

故事扮演 提交于 2019-12-01 06:43:20
I'm having trouble launching Cucumber test with Chrome using remote webdriver capabilities on Grid (1 linux hub and 1 linux node with Firefox and Chrome). Firefox test go very well but Chrome returns the following error: unknown error: Chrome failed to start: exited abnormally (Driver info: chromedriver=2.2,platform=Linux 3.2.0-23-generic-pae x86) (WARNING: The server did not provide any stacktrace information) java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException Command duration or timeout: 20.67 seconds Build info:

Chrome on remote webdriver (via Grid) failed to start

吃可爱长大的小学妹 提交于 2019-12-01 04:46:53
问题 I'm having trouble launching Cucumber test with Chrome using remote webdriver capabilities on Grid (1 linux hub and 1 linux node with Firefox and Chrome). Firefox test go very well but Chrome returns the following error: unknown error: Chrome failed to start: exited abnormally (Driver info: chromedriver=2.2,platform=Linux 3.2.0-23-generic-pae x86) (WARNING: The server did not provide any stacktrace information) java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException:

Dismiss “Confirm Navigation” popup with Watir

允我心安 提交于 2019-12-01 04:16:29
I am trying to dismiss "Confirm Navigation" popup. This is how it looks like in Chrome. To see the popup: require "watir-webdriver" browser = Watir::Browser.new browser.goto "http://www.gravityforms.com/demo/wp-admin/admin.php?page=gf_new_form" browser.text_field(:id => "user_login").set "demo" browser.text_field(:id => "user_pass").set "demo" browser.button(:id => "wp-submit").click browser.refresh At the moment I override onbeforeunload when I visit the page, as suggested at http://watirwebdriver.com/javascript-dialogs/ browser.execute_script("window.onbeforeunload = function() {};") So, the