C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Locating Strategies- (By XPath- Using Double Slash)In this section, you will learn how to locate a particular web element by XPath- Using Double Slash. Double Slash mechanism is also known as finding elements using Relative XPath. Double slash is used to create XPath with relative path i.e. the XPath would be created to start selection from anywhere within the document. - Search in a whole page (DOM) for the preceding string. Note: Double Slash is recommended when you don't have a suitable id or name attribute for the element you want to locate.Using Double Slash/Relative XPath, we can write the Java code along with the dynamic XPath location as: findElement(By.xpath("//form/div[1]/div/div[1]/div/div/input[1]"));
Next TopicLocating Strategies- By XPath
|