We can check the presence of WebElement on page by implementing custom isElementPresent method as below:
protected boolean isElementPresent(By by) {
try {
driver.findElement(by);
return true;
} catch (NoSuchElementException e) {
return false;
}
}
This method will return true, if the WebElement with ‘by’ available otherwise returns false.
Here is the same function converted to C#
ReplyDeleteprotected bool IsElementPresent(By by)
{
try
{
driver.FindElement(by);
return true;
}
catch (NoSuchElementException)
{
return false;
}
}
My question is
ReplyDeleteLet say your method signature is like this
protected boolean isElementPresent(WebElement elment)
in this case you have webelement not locator then how will you check whether element is present or not
Findelement(by By) will show an element if it is present in the DOM. This will also return true if the element is present in the DOM but hidden from the user. "Visibility" refers to present in the DOM and in the UI ( i.e. not hidden)
ReplyDeleteYou have hundreds of online brokers to choose from, so we are here to help you make an informed decision. Online Stock Broker provides many resources including a comparison system based on the top brokers in the industry, Brokers Review And There Login Details to help you find the one that is best for you.
ReplyDeleteTo view the real-time Fxit Stock price and to get an overview of the key fundamentals, simply visit Our Servlogin Webpage. You'll get access to revenue, earnings, valuation, predictors, and technical analysis from experts, news, historical data and Much More.
ReplyDelete