Let’s assume that you’re a tester working on some kind of web application. When you were dealing with element collections in Watir 1. Stack Overflow works best with JavaScript enabled. Interactions Basic interactions with all elements may be executed with these methods: Multiple locators Starting from Watir 2. What about the second. This approach takes a lot of your time, and requires meticulous attention to details.

Uploader: JoJokinos
Date Added: 7 February 2013
File Size: 54.77 Mb
Operating Systems: Windows NT/2000/XP/2003/2003/7/8/10 MacOS 10/X
Downloads: 31195
Price: Free* [*Free Regsitration Required]

Zero based indexing The next big change is zero based indexing. If you know Selenium, you can also perform some advanced configurations.

ruby – How to determine what type of a HTML element is selected in Watir – Stack Overflow

But let’s not fool ourselves – test automation is hard. The Watir location API is designed to be easily read and understood by users humans. If you got the error, then it does not support it. Even better, all major browser automation frameworks have implemented it. As previously mentioned, real users mainly perform watiir-webdriver actions on a web page: What worked for me was Watir http: I use watir-webdriver almost all the time.

Browser automation with Watir – guide (not only) for testers

JS-heavy flows, tests that are dependent on the state of the app or require processing a lot watir-wbedriver data. Check your email inbox. Most of the time Watir can translate the Selector Hash into a single XPath expression to quickly identify the element. Watir-WebDriver Watir is short for Web Application Testing in Ruby is a Ruby gem which allows you to automate your browser make it click a button, submit a form, wait for some text to appear before continuing, and so on.


Something similar to the nodeName or the tagName method in Javascript.

When you were dealing with element collections in Watir 1. This means that each page would have a html element like: Interactions Basic interactions with all elements may be executed with these methods: Ask yourself these questions: Since, its an collection, I can use the each method to iterate over the collection.

Get attribute values of the html element | Testing by Justin Ko

When to do it? In other words – if no other locators are specified, then: What is hardest to automate? You can also extract most of the element attributes the same that we can locate on this way. Elements are located by creating a Selector Hash, which Watir translates into the potentially complicated information the driver needs to know to identify the element.

If you don’t, don’t be afraid – it’s a language where code almost writes itself, I recommend giving it a shot. As for Watir-WebDriver vs.


will get the first row

Put any values you want in it. Women in Technology is an organization for women who work in technology or create them as a hobby, located in couple of cities all over Poland. However you can get the html element by index. We respect your privacy, and We will never sell your information to any third parties view our Privacy Policy. The creators of Watir-WebDriver, knowing this, decided to create a fairly intuitive syntax to allow you to simulate almost anything a real user would do on a particular webpage.

Fill it in manually.

If you forget about it, it’s really easy to end up spending more time on writing and maintaining tests than what you gain in the end: You are commenting using your WordPress. You can revert to one-based-indexing to make the integration from Watir 1.