What will you learn in this lecture?
In the previous video, we learned how to use link text to identify an element in Selenium. In this video, we’ll learn how to use partial link text to identify an element of this Selenium webdriver elements identification course.
How to Use Partial Link Text to Identify an Element
Before we proceed to the next identifier, I quickly wanted to mention that these commands here for Selenium don’t really change much from binding to binding, meaning that if you’re using Ruby, Python, Java, whatever, these commands don’t really change which is what makes Selenium so cool because no matter which language you’re using you can easily go from place to place and be able to use Selenium webdriver.
The only thing that changes is like little conventions right because this is C# specific but if you’re like using Ruby or Python and Java only the conventions change of the naming conventions and some other things that Java or whatever language you’re using does differently. But the methods like find element, find elements, the by all of that stays pretty static throughout the different language bindings and so migrating between them becomes really easy.
So you can actually utilize these techniques that I’m teaching you for whatever language you want. You don’t have to have visual studio all you need is these commands executed on your driver class and then you’ll be able to do exactly what I’m doing on whatever Selenium binding you choose to use.
So let’s move on to the next identifier which is going to be partial link text.
So that’s exactly as it sounds using not the full link text but just the partial link text so if we comment this out and come here uncomment this so and then go back to Firefox and see that link it said click me using the link text. Instead, we’re just going to put and click me here and so I’m going to debug up to here right click debug unit tests it’s going to start running it’s going to run up to here and then hopefully it clicks.
So as you see that work and it did click on the link you guys saw it switch to the page and basically the advantage of this is rather than using this whole string which is actually wrong this isn’t the right element instead of using this whole string right here you just use click me or you can probably even use using this link depending on what you need what your requirements are.
Sometimes you may only want one word out of an entire link right if we have like five of these links they’re the same but this one says click me if you love QTP, click me if you love Selenium, click me if you love UFT or click me if you are a cool guy and maybe the only thing that changes is right the QTP the UFT the selenium cool guy so those values you just want to click on if it contains selenium or QTP and so on and so forth that’s how you can utilize that partial link text identifier this guy right here and that’s again standard of the BI class in selenium and again these are very simple objects that we’re going through right now and we’ll get into more complicated scenarios where you guys will become experts at identifying everything.
[Tweet “Learn everything about elements identification with Selenium Webdriver.”]
In the next tutorial, we will cover how to use CSS to identify an element in Selenium.
What will you learn in this course?
Are you struggling with working with HTML using Selenium WebDriver? Do you know how to easily identify an element using Selenium WebDrriver? Do you know how to manipulate that web element? Do you know how to perform a drag n’ drop on an element? If not, then these are just a few of the questions that will be answered in this course.
This course is a complete guide on working with web elements in Selenium WebDriver! Once you are finished with this course, you will know how to work with any web elements, any time, on any web application.
“Relevant content that I will be able to apply to my automation tests *immediately*, a VERY effective presentation approach (evolving the same example and comparing/contrasting), and an excellent teacher / presenter. Thank you so much for your time and sharing your knowledge Nikolay!.”
In this course from Ultimate QA, you will learn:
- Basics of HTML
- All the different locator strategies for Selenium WebDriver
- How to identify web elements using Selenium WebDriver
- Master XPath
- Navigation with Selenium WebDriver
- Web element manipulation
- Web element interrogation
- Mouse and keyboard actions with Selenium WebDriver
- Performing actions such as drag n’ drop, drawing, hovering
- Implicit and Explicit waits
- How to properly handle element identification so that your tests are not flaky
- Expected Conditions in Selenium WebDriver
Take This Entire Course for Free
[Tweet “Learn how to correctly identify elements using #Selenium #Webdriver.”]