Professional Documents
Culture Documents
Day 4
Day 4
A:
Q. How do you open the login page without using get method?
A:
A: "close ()" will close only the current browser (main browser) where
as "quit ()" will close all the browsers of current WebDriver instance.
Ex-1:
Ex-2:
Synchronization:
The above code will make the script to always wait for 10 seconds.
Limitation of sleep ():
IMPLICIT WAIT:
Ex: If the timeout is 10 sec then during runtime if the element is not located
then the selenium will keep searching for the element if it is found at 5th sec
it immediately performs the operation & it will not wait till the 10 seconds. If
the element is not found even after 10 seconds then only it will through the
exception.
System.out.println("error...."+driver.findElement(By.xpath("//td[@class='overtimebut
tontd '][1]/a")).getAttribute("title"));
//System.out.println("error...."+driver.findElement(By.id("headerContainer")).getCssVa
lue("color"));
}
}
Q. How do you login to the application without clicking on the login button?
A: We can login to the application by pressing Enter Key after typing or
entering username & password instead of login button.
SUDHEER REDDY ANKIREDDYGARI
SELENIUM WEBDRIVER
Note:
In WebElement interface we also have "isDisplay()" method to check
whether element is displayed not & "isEnabled()" method to check
whether the element is enabled or disabled.
Page 6 of 6