adspace
Answer Posted / Raj Bhushan Dube
To assert text on a webpage using Selenium 2.0 (WebDriver), you can use the `getText()` method followed by `assertEquals()` for verification:
1. Get the text from the desired element: `String expectedText = driver.findElement(By.xpath("//your xpath")).getText();`
2. Verify the actual text with the expected text using `assertEquals()`: `assertEquals(expectedText, "Expected Text");`
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers