WebElement m=driver.findElement(By. WebElement l=driver.findElement(By.xpath("//*")) Using the XPath contains () function, we can extract all the elements on the page that match the provided text. Contains function has two arguments as a String and is much preferred for a part of a value. tProperty("", "C:\\Users\\ghs6kor\\Desktop\\Java\\chromedriver.exe") ĭriver.manage().timeouts().implicitlyWait(12, TimeUnit.SECONDS) Xpath Contains is an XPath function that is used to find Dynamic web elements and returns a partial attribute value to locate the web element. For example, if we want to identify GATE Exams from the above webpage, the customized xpath with contains() should be For example, if we want to identify Library from the above webpage, the customized xpath with text() should be −Ĭontains() − It is a built in function to identify an element based on the partial text match. Text() − It is a built in function to identify an element based on the text displayed on the screen. Let us consider a portion of the web page as given below − The xpath locator contains some in-built functions that help to create customized xpath. We can find an element with a specific text visible on the screen in Selenium.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |