Interview Questions

Selenium WebDriver - Explain how to assert text of webpage using selenium 2.0 ?

Selenium WebDriver Interview question and Answers


(Continued from previous question...)

Selenium WebDriver - Explain how to assert text of webpage using selenium 2.0 ?

WebElement el = driver.findElement(By.id(“ElementID”))

//get test from element and stored in text variable

String text = el.getText();

//assert text from expected

Assert.assertEquals(“Element Text”, text);

(Continued on next question...)

Other Interview Questions