C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Locating Strategies- (By XPath- Using text())In this section, you will learn how to locate a particular web element by XPath- Using text() method. "text() method" is used to identify an element based on the text available on the web page. Let us consider an example in which we will try to locate the text "Google offered in" on the default page of Google Search engine. The syntax for locating elements through XPath- Using text() method can be written as: //*[text()='Google offered in'] Using XPath- text() method, we can write the Java code along with the dynamic XPath location as: findElement(By.xpath("//*[text()='Google offered in')]"));
Next TopicLocating Strategies- By XPath
|