watir-webdriver

prevent watir-webdriver running chrome as a first run

痞子三分冷 提交于 2019-12-13 17:31:09
问题 Everytime I use watir-webdriver to initialise a chrome browser instance, it launches as a first-run with an EULA pop-up and an additional getting-started tab open. Both of these side-effects are preventing me from automating tests for chrome. I have tried initialising a browser using just Selenium::WebDriver.for :chrome, :switches => %w[--no-first-run] but have the same result. I am surprised to be unable find any other questions online about this, so assume I have done something weird! I

Default profile name in Chrome when using Watir-Webdriver?

六眼飞鱼酱① 提交于 2019-12-13 15:50:46
问题 I downloaded the Chromedriver then I extracted it to the right place (usr/bin), but I don't know what is the default profile name for the Chrome (Chromium) browser, so this line throw an error message: browser = Watir::Browser.new :chrome, :profile => "default" I tried either "current" or my username instead of "default", but none of them worked. How can I start Chrome with my default profile? Because I don't want to start a new profile without the usual preferences, and saved passwords,

Cannot create firefox browser with watir-webdriver

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 07:46:37
问题 I have firefox 20 which works with my version of watir-webdriver. I use the following code which can open any browser or a headless phantomjs browser. Chrome and phantom work, but firefox throws an exception. Why? How do I fix this ? require 'rubygems' require 'watir-webdriver' require 'phantomjs' def get_browser(browser_name) browser = nil if browser_name != nil puts "\n#{browser_name} created\n" browser = Watir::Browser.new browser_name.to_sym else puts "creating phantom browser !" browser

Watir How to get rows with different classes

空扰寡人 提交于 2019-12-13 06:05:20
问题 I need to get all rows with class named 'odd_row' or 'even_row'. HTML: <tbody> <tr class="first_row"> … </tr> <tr class="subjectField" style="display:none"> … </tr> <tr class="odd_row"> … </tr> <tr class="subjectField" style="display:none"> … </tr> <tr class="even_row"> … </tr> <tr class="subjectField" style="display:none"> … </tr> </tbody> I tried this: @b.table(:class => 'color_table').tbody.trs(:class => ('odd_row' || 'even_row').size But it returns 1. Does anybody know how to solve this

How do I specify the browsers in my cucumber.yml files?

守給你的承諾、 提交于 2019-12-13 04:39:42
问题 I want to create cucumber profiles and specify the browsers I want to run the tests on in my profiles. For example my cucumber.yml looks like: default: @chrome --tags @sanity1 --require features firefox: @ff--tags @sanity1 --require features How can I do that? 回答1: You could add an environment variable for the browser type. Then in your test, use that variable to determine the browser to create. For example, you could add a BROWSER variable to your cucumber.yml profiles: default: BROWSER

How can I get some particular link form the links collection

流过昼夜 提交于 2019-12-13 04:37:52
问题 I'm using watir-webdriver have several lines of the same code shown below: ... <p class="schedule-text"> by <a href="http://www.somesite.com">MarketingClub</a> in <a href="http://www.somesite2.com">Marketing</a> </p> I need to get the first links included in p tag and the second links included in p tag so using page object I've added the following code: links(:followees_category, :css => "#home-followees li.animate-in ul li[data-show-id] p.schedule-text a") ... followees_category_elements

how to open pop up window table using selenium webdriver?

六眼飞鱼酱① 提交于 2019-12-13 04:15:53
问题 there is text label on a webpage, and I am trying to click on that to open a pop-up window,but not getting opened. here is the HTML code: <td width="40%"> <div id="EmpId.outline"> <input type="hidden" name="EmpId" value="" id="popupEmpId"> <input type="text" name="EmpCode" value="" readonly="readonly" class="textMedium250" id="popupEmpCode" autocomplete="off"> <a href="#f2"><label onclick="checkForPopup('EmpPopupDiv','Select a Emp',640,true,refreshConditionOptions);"> + Search for a Emp<

How to add text to any html element?

十年热恋 提交于 2019-12-13 02:23:18
问题 I want to add text to body element but I don't know how. Which method will work on the body tag? Sorry for my english and thanks for replies. 回答1: In Watir, you can manipulate a web page (DOM) using JS, just like that: browser.execute_script("document.getElementById('pageContent').appendChild(document.createTextNode('Great Success!'));") I assume that the point of the question is: All users are not just interacting by just clicking buttons and links on the web app, some of them are doing

Accessing a table within a table (Watir/PageObject)

一个人想着一个人 提交于 2019-12-13 01:15:13
问题 I'm running Watir-webdriver with Cheezy's PageObject for Cucumber testing. I am new to ruby, testing, pageobjects, and watir. I am trying to access a table. Specifically, I'm trying to click an image in the 7th column. This is my code: tables.downcase! tables.gsub!(/\s+/, '_') tables_elements = self.send("#{tables}s_elements") the_table = tables_elements[table_number] the_table[row_number][column_number].click With this code running, it becomes apparent that it believes the table (columns,

Watir-webdriver timing out when asked if element is present?

做~自己de王妃 提交于 2019-12-12 17:20:26
问题 Ruby 1.9.3p327 watir-webdriver 0.6.1 On a fresh Ruby install, with a fresh webdriver install, I am unable to use wait or present? with nonpresent elements without causing non-Watir Timeout errors. In the below example, id 'gb_32' is on the page, but hidden. Id 'gb_50000' does not exist. In both cases "present?" should return false, but the second one gives me a timeout error after 60 seconds. Any ideas why this could happen? irb(main):014:0> b.link(:id,'gb_32').present? => false irb(main):015