watir

Ruby - Watir - PhantomJS

浪子不回头ぞ 提交于 2019-12-24 13:52:57
问题 I'm on debian. I have ruby set up with bundle. I do sudo gem install watir-webdriver sudo gem install phantomjs Then I add both to my Gemfile. Then I do bundle install. Then I run ruby code Watir::Browser.new(:phantomjs) and get this error: /var/lib/gems/2.1.0/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver/phantomjs/service.rb:38:in `executable_path': Unable to find phantomjs executable. (Selenium::WebDriver::Error::WebDriverError) How do I make this work? Thanks! 回答1: you don't have

How to pass Chrome options in webdriver-user-agent gem for watir

本秂侑毒 提交于 2019-12-24 11:20:37
问题 I am trying to pass cookies option for Chrome Drive using Watir gem From Watir documentation i can do Watir::Browser.new :chrome, opts So for cookies I can do: browser = Watir::Browser.new :chrome, options: {args: ['--user-data-dir=/cookies']} When using the webdriver-user-agent gem for mobile testing, their documentation tells me to start the browser like this: driver = Webdriver::UserAgent.driver(browser: :chrome, agent: :iphone) browser = Watir::Browser.new driver But now I don't know how

WATIR Safari automation Issue

依然范特西╮ 提交于 2019-12-24 10:48:01
问题 I am new to WATIR and I want to automate Safari browser. I am using require 'safariwatir' statement in my ruby file. I am able to open a safari browser window but when I call goto method on my browser object then the result is NIL. It shows FAILED TO OPEN PAGE. Please help me with this. Thanks in advance. 回答1: safariwatir gem is no longer in active development. The last release was three years ago. You should use watir-webdriver gem to drive Safari. 来源: https://stackoverflow.com/questions

Watir-WebDriver: Find elements which class is not 'completed'

匆匆过客 提交于 2019-12-24 09:55:22
问题 I have a bunch of li elements. They are either with uncompleted , 'current' or completed class or without a class. How do I find all li elements without completed class? So far I am doing this by selecting necessary li objects from collection of li (through calling #attribute_value('class') , but maybe there is some elegant locating strategy in Watir-WebDriver? UPD: As long as there is some misunderstanding of the question. I want to know if there is locating strategy within Watir-WebDriver

Can I copy a text on a webpage and paste it in a text file?

天大地大妈咪最大 提交于 2019-12-24 09:15:08
问题 I have a webpage which dynamically displays a text which I want to copy into a text file using watir-webdriver or any other additional gems. Is it possible?? If yes, how?? Thanks in advance.. 回答1: If you are talking about web-scraping try Nokogiri 回答2: I will assume that you you have HMTL like this: <div id="tehcodez">teh codez</div> This would save text teh codez to file tehcodez.txt (not tested): text = browser.div(:id => "tehcodez").text File.open("tehcodez.txt", "w") {|file| file.write

Watir script occasionally returning Net::ReadTimeout error

只愿长相守 提交于 2019-12-24 08:49:16
问题 I have a Watir script, that occasionally and unpredictably returns this error: Net::ReadTimeout I searched this error and found this question already asked. I followed the top answer, and implemented this: attempts = 0 url = "https:/www.google.com/" begin doc = Watir::Browser.start url rescue Net::ReadTimeout retry end but I'm still getting the same timeout error. I've never had any connection issues with my network. I get the error on both an Ubuntu and a Windows 10 machine. My code goes

how to update watir?

淺唱寂寞╮ 提交于 2019-12-24 08:21:19
问题 i am getting error while truing to install watir C:>gem install watir ERROR: http://rubygems.org/ does not appear to be a repository ERROR: Could not find a valid gem 'watir' (>= 0) in any repository C:>gem -v 1.3.7 C:>ruby -v ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32] 回答1: Try gem sources -a http://gems.github.com and then gem install watir 回答2: One line solution (since I can't vote yet): gem install watir --source http://gems.github.com 回答3: That looks like a proxy problem.

How to make sure the appium node is connected to only one phone?

泄露秘密 提交于 2019-12-24 07:37:25
问题 I run (all on one machine) multiple appium servers connected as nodes to a selenium-grid hub and I have multiple phones connected to my adb on port 5555 (in my case via WiFi). The issue I have with this is that two of the three phones have capabilities that are matching (Android 7.1.1, Chrome browser). So when I fire up a test for the nexus 9, if occupies the grid node for nexus 6. Or even the other way around, I ask to run the test on the nexus 6, this one get occupied, but the test runs on

Watir loses browser connection after first goto

限于喜欢 提交于 2019-12-24 07:08:00
问题 I am completely new to Watir, trying to work out the basics so we can use it for testing our websites. The problem is, following the 'Watir in 5 minutes' after I do my first browser.goto , I seem to lose connection to the browser window. The window is still there, but I can no longer "command" it from irb. I just get this error: C:\>irb DL is deprecated, please use Fiddle irb(main):001:0> require "watir-webdriver" => true irb(main):002:0> ie = Watir::Browser.new :ie Started

Chrome detach option is no longer working

帅比萌擦擦* 提交于 2019-12-24 06:30:35
问题 There is a question for Ruby Selenium Binding here Selenium WebDriver in Ruby: Preventing the test from closing the browser window at end He was trying to not to close the window of Chrome after the execution but it's not working. I have had the solution for this problem, the given below program works fine earlier, but now it's not working require 'watir' caps = Selenium::WebDriver::Remote::Capabilities.chrome(chrome_options: {detach: true}) b = Watir::Browser.new :chrome, desired