Questions tagged [watir]

Watir (pronounced water) stands for Web Application Testing in Ruby. Watir is an open-source (BSD) family of Ruby libraries for automating web browsers. It is distributed as a Ruby GEM named 'Watir'. Watir was primarily developed by Bret Pettichord and Paul Rogers.

Filter by
Sorted by
Tagged with
0 votes
0 answers
49 views

Open new window when already logged with watir

Is there a way to open a new window or tab when already logged in a site, and open it as a logged user? When I try to open it with a new browser window it opens it as a guest user. My code structure ...
  • 33
0 votes
1 answer
91 views

I am getting "Uncaught ReferenceError: tippy is not defined "

I have written this code require 'watir' b = Watir::Browser.new b.window.maximize b.goto 'URL' # var headElement = document.getElementsByTagName(\"head\")[0]; sleep 3 b.execute_script(&...
  • 5,207
0 votes
1 answer
45 views

Problem interacting with elements inside an iframe

I'm able to retrieve data inside an iframe using browser.iframe But when I try to interact with elements inside this iframe, like for ex. click on a button, watir won't locate any of them. I tried ...
  • 33
0 votes
1 answer
34 views

Watir following_sibling Not Seeing Element

I'm trying to get an element's text and it somehow isn't working. ## html: <table class="infobox vcard"> (snip) <tbody> <tr>(stuff)</tr> <tr>(stuff)</tr> &...
  • 1,754
0 votes
2 answers
59 views

Watir Scroll For All Comments

I'm trying to scroll until there are no more contents on a Youtube video. I'm testing a counter versus the current number of comments displayed. mycount = 0 1.upto(20) do thiscount = browser.div(id:...
  • 1,754
0 votes
0 answers
47 views

Handling Shadow Dom with Watir

How can I handle elements that are inside iframe which are again inside a shadow Dom using watir 7.2? Something like this: <div id="test"> #shadow-root (open) <div id= "test1&...
-1 votes
1 answer
30 views

How Can I Click This Link Using Watir?

I want to navigate a site using watir. I can't find nor focus on an element to click on it. It's the Next link on top right of this url: Companies How can I test that the link exists and can focus ...
  • 1,754
0 votes
1 answer
57 views

Last index can't be located

I have a very different problem here. I have this code xpath = "//div[@class='z-listheader-content'][normalize-space()='Name']/ancestor::table/../following-sibling::div/table" array = @...
  • 5,207
0 votes
0 answers
37 views

I am trying to debug my Ruby project, but getting error "evaluation memory limit is ineffective mri < 2.0"

In my project we have used cucumber with bdd framework, when i try to debug it's not redirecting to step definition file, script terminating abruptly.
0 votes
1 answer
51 views

trying to update the text in a p tag using watir

I am trying to automate entering some values on a website. There is a <p>Home</p> html line that I need to change to <p>Accueil</p> (that's french) I have my script logging in, ...
1 vote
1 answer
177 views

Watir browser initialization failing due to Selenium argument error

I am suddenly getting an error when initializing a Watir browser. Using current versions of watir-rails and selenium-webdriver gems. When initializing a chrome headless browser: browser = Watir::...
0 votes
1 answer
48 views

executing in another thread|RuntimeError

I have something similar in my project class Raj def execute 5.times do Thread.new do object = Gopal.new object.db_connection object.enter_tax_id end end ...
  • 5,207
0 votes
1 answer
21 views

Could not convert the given xpath into WATIR code

//div[text()='#{locator.strip}']/ancestor::table/../../..//a[@class='idit-grid-btn']/i[@class='fa fa-#{var}'] I have written the following watir code for the aforementioned xpath but it's not working....
  • 5,207
0 votes
0 answers
22 views

click datatable step defination for cucumber watir ruby framework

Does anyone have proper practical step definition for this? And I click the following likes: | a | | b | Expecting proper step definition to click those elements from datatable
0 votes
1 answer
32 views

How can I write this xpath expression in WATIR methods

I have to form the following xpath via watir methods, //span[@class='fieldTitle-small required z-label'][contains(.,'Address Type')]/../following-sibling::div//input Is there a way to call the watir ...
  • 5,207
1 vote
0 answers
30 views

Is there a simple way in Ruby to get the terminal output? [duplicate]

I’m running tests using Watir and certain results get posted to the terminal for convenience by using puts or print. Is there a way of extracting or dumping the terminal output somewhere if for ...
0 votes
1 answer
52 views

scraping data using Watir no longer loading JSON dynamic content from a website

I've been using watir to scrape data from nfl.com for over a year and it suddenly stopped working. It appears that it's a timing issue and is loading the site before the json data is finished loading ...
1 vote
0 answers
41 views

Is it possible to send screenshots to Slack from a Ruby-Watir test?

I currently have a Slack webhook that allows me to post results from my script to Slack. I was just wondering if it's possible to post a screenshot to Slack? I already save screenshots to my local ...
0 votes
2 answers
114 views

WATIR: Is there a reason why browser scrolling won't work?

I'm trying to use browser.scroll.to :bottom but nothing happens. I know that it works because I've tried it on public facing sites such as the BBC and Wikipedia, but for some reason, these scroll ...
0 votes
1 answer
60 views

Watir: ignore invalid Browser certificates

I'm trying to tell Google Chrome to ignore invalid Browser certificates with the command line switch from official documentation [1]: Watir::Browser.new :chrome, switches: ['--ignore-certificate-...
2 votes
1 answer
74 views

Ruby until loop ending too soon

I'm using Watir to collect all items from a page with an infinite scroll. Created an until loop that counts the number of items in the 'before' state, scrolls to the bottom of the page and counts the ...
0 votes
1 answer
53 views

Selecting Date from the Datepicker. How do I do that using WATIR

I don't know how to select the date from the date picker, For an example, If I want to select 1/5/2022, how would I do that? here is the pic Here is the Html <div style="visibility: visible; ...
  • 5,207
1 vote
1 answer
73 views

Watir won't open Firefox

I'm trying to use Watir with Firefox: browser = Watir::Browser.new :firefox, options: {prefs: {'intl'=> {'accept_languages'=> 'en-US'}}} But keep getting this error: Preference values not all ...
0 votes
0 answers
45 views

Problem accessing elements by class or ID

I have to access a div collection and extrapolate some data cycling through it. names = b.divs(class:"item ng-final") names.each do |name| data = name.text puts data end It grabs ...
0 votes
1 answer
40 views

Watir - scraping a grid of items

I'm trying to scrape the app URLs from a directory that's laid out in a grid: <div id="mas-apps-list-tile-grid" class="mas-app-list"> <div class="solution-tile-...
0 votes
1 answer
102 views

How to run selenium grid with ruby watir?

I'm working on Ruby Watir project. Currently, I want to execute test script on Selenium grid. My test script is: caps = Selenium::WebDriver::Remote::Capabilities.chrome browser = Watir::Browser.new(:...
  • 13
0 votes
1 answer
19 views

using send to validate my data from populate_page with

I'm trying to use a hash of data that obtain from data_magic to set values on page, do a refresh and then use that same set of data to validate that the page loaded back with that which was set. ...
  • 112
-1 votes
1 answer
51 views

Is there a way to access the Xpath selector that Watir uses for selenium?

I'm familiar with using the various different approaches to selecting elements in Watir. Instead, I want to do the opposite: I have an element which I have already enumerated, and I want to generate a ...
  • 1,607
1 vote
2 answers
104 views

Watir: select an element with multiple custom attributes

When creating a Watir script that clicks a right pagination arrow, I can't seem to find a solution to grabbing the bottom 'kat-icon' tag: https://imgur.com/CNs7kXH Tried using a lot of different ...
1 vote
1 answer
160 views

watir selenium: unrecognized arguments for Browser constructor

In my rails app I have a nokogiri, watir crawler that was working fine. After I upgraded my gems (also upgrading e.g. selenium), when I open the crawlers browser with: BROWSER_OPTIONS = %w[--headless -...
  • 289
1 vote
1 answer
99 views

how to specify driver path in ruby watir 7?

While am specifying driver path in watir 7 it throws below error How to specify driver path please help browser_opts = {driver_path: 'C:/software/SELENIUM-DRIVERS/chromedriver.exe'} Before do @...
  • 329
0 votes
1 answer
42 views

how to format a table using nokogiri as in specified format

I tried using below code but am getting the details like below: Can any one please provide the solution for it. class HtmlTablePage include PageObject page_url 'https://www.w3schools.com/html/...
  • 329
0 votes
1 answer
106 views

WATIR. Can you use Begin > Rescue within a function / method?

I'm trying to have a function that handles exceptions for different elements in the system. The Begin / Rescue code works, but once it's placed within a function, the Rescue part doesn't work and the ...
0 votes
1 answer
56 views

Switching windows using Watir is timing out

I want to automate work between two browser windows within the same Watir session. However, the code below times out before I'm able to see a new browser tab open. b = = Watir::Browser.new :chrome b....
0 votes
1 answer
69 views

Setting browser settings in Watir

Because of some bugs when using Watir in Chrome 103, I've downloaded Chrome Beta 104 and set it as the default browser. Watir still keeps using 103 though. I've also tried setting the browser version ...
1 vote
0 answers
119 views

Eval alternative for rubocop

I have the following method: def expect_url_to_end_with_string(*args) method_string = 'expect(driver.url).to end_with(url_str)'.dup args.each do |arg| method_string.concat(" | end_with(\'#{...
-1 votes
1 answer
42 views

Undefined method 'count' when using '.map' in Watir

I'm using Watir to load all apps in a directory with infinite scroll and count them: grid = browser.divs(class: 'rows')[1] app_urls = grid.map { |app| app.a(class: 'element Link clickable-element')....
0 votes
2 answers
121 views

How to scrape star ratings displayed as an image set as a background URL?

There are some websites that display different star ratings based on a single image set as background, for example: https://appexchange.salesforce.com/appxListingDetail?listingId=a0N30000004gHhLEAU ...
3 votes
0 answers
292 views

AWS Lambda Ruby 2.7 and Selenium can't connect to Chrome

I intend to create an AWS lambda function using Ruby 2.7 with Selenium. When I try to run my example function i get: { "errorMessage": "unable to connect to /opt/chromedriver 127.0.0....
  • 1,421
0 votes
1 answer
65 views

How to click every div with a specific class name

I'm quite a newbie programmer so pardon me. I have to open a bunch of popup windows from the main one, to scrape some data. But there's not a link just many divs with the same class name, that when ...
  • 1
0 votes
0 answers
24 views

How to call ruby Watir script from GUI webserver

I have a static Watir script to fill a form which works fine locally. I'm planning to add a web UI in order to make it dynamic and user-accesible. User will fill in a form, and those values will be ...
1 vote
0 answers
143 views

Class methods vs Instances when using Page object model in ruby

I hope you are having a great day! I'm wandering something, when using the POM (Page object model) we always create new instances of our classes, like the following simple example: class LoginPage ...
0 votes
1 answer
44 views

How to convert a string to an object reference in ruby

I want to take in a page name in a gherkin step then set it as an object reference (I think that's what it's called.) Then I can use that to interact with page elements. Is there an easier way to do ...
0 votes
0 answers
44 views

Watir Click JS Button

I can't seem to get past a button in a landing page. Here is the JS element with parent nodes: <div class="modal-body-content callfor-popup"> <h3>Welcome | Bienvenue</h3>...
  • 1,754
0 votes
0 answers
502 views

Watir Raising Error, "Net::ReadTimeout: Net::ReadTimeout with #<TCPSocket:(closed)>" When Attempting To Create New Browser

I am working on a rails application that pulls data from a REST endpoint and then scrapes a production website that consumes said endpoint to ensure the contents is present and displaying correctly. I ...
  • 103
2 votes
2 answers
834 views

Accessing browser dev tools and capturing network traffic using Watir

Have a requirement to capture network traffic from the browser while running automation test cases. Came across below post but not sure if it has been included as part of Watir 7. Appreciate if there ...
0 votes
1 answer
135 views

Watir Set value of input type="text"

I am trying to set an email into this span but I'm having trouble selecting it and updating it. The span id is created dynamically but the class is not <div class="input input-lg form-input&...
0 votes
1 answer
38 views

Watir Invisible Button Breaking Ruby Script

I'm using Watir to load a page. It loads items, and has a LOAD MORE button at the bottom if there are further products. In the HTML the button exists even if there are no more items to load, but it's ...
  • 1,754
0 votes
0 answers
40 views

Correct formatting of no_proxy noProxy in browser constructor in watir

Is this the correct way to use no_proxy/noProxy? it seems to work in firefox but not chrome, using actual chrome version 99. The WATIR proxy documentation does not cover this. proxy_object = nil ...
0 votes
1 answer
113 views

Ruby + watir: format cookie for web crawler

I have started building a web scraper to get some data for an API, however the url requires a 'continue as guest' for each daily visit. This is the cookie I from the request header: web_site=...

1
2 3 4 5
53