Selenium Part 2 - Jaikishan
Selenium Part 2 - Jaikishan
with Details
Part - 2
By : Jaikishan Mohanty
#5) Handling iframes
● Select iframe by id -- driver.switchTo().frame(“ID of the frame“);
● Locating iframe using tagName --
driver.switchTo().frame(driver.findElements(By.tagName(“iframe”).get(0));
● Locating iframe using the index: -- driver.switchTo().frame(0);
● Locating by Name of iframe -- driver.switchTo().frame(“name of the
frame”);
try{ if(saveButton.isDisplayed()){
saveButton.click();} }
catch(NoSuchElementException e){
e.printStackTrace(); }
Other useful Commands :
● isEnabled() -- to Check Whether the Element is Enabled Or Disabled in the Selenium
WebDriver.
● implicitlyWait() -- to set a wait time before searching and locating a web element.
driver.manage().timeouts().implicitlyWait(1000, TimeUnit.SECONDS);.
Other useful Commands :
● until() and visibilityOfElementLocated() -- until() from WebdriverWait
and visibilityOfElementLocated() from ExpectedConditions to wait explicitly till an element is
visible in the webpage.
THANK YOU
Jaikishan Mohanty