1. How can we select the value of Dropdown in Selenium Webdriver
You should use Select Class and create object of Select class.
Select dropdown = new Select(driver.findElement(By.id("abcdefg")));
Below is Sample HTML
<html>
<body>
<select id = "Name">
<option value = "GK">Gaurav</option>
<option value = "JD"> Jaideep </option>
<option value = "AN"> Arjya </option>
</option>
</select>
<body>
</html>
To select its option say 'Gaurav' you can do
dropdown.selectByVisibleText("Gaurav");
or
dropdown.selectByIndex(1);
or
dropdown.selectByValue("GK");
2. Types of Wait in Selenium Webdriver
3. Why We do not require the to Set System Property to Use Firefox Driver in Selenium WebDriver
Because Firefox driver is included in the selenium-server-stanalone.jar . The driver comes in the form of an xpi (firefox extension) which is added to the firefox profile when you start a new instance of FirefoxDriver.
4. How can we accept Untrusted SSL certificate in WebDriver for Chrome , IE and Firefox Browser
Firefox:
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("setAcceptUntrustedCertificates","true");
driver = new FirefoxDriver(profile);
Chrome:
System.setProperty("webdriver.chrome.driver",
"Path to ChromeDriver//chromedriver.exe");
DesiredCapabilities capability = DesiredCapabilities.chrome();
capability.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
driver = new ChromeDriver(capability);
IE:
System.setProperty("webdriver.ie.driver",
"Path to IEDriver//IEDriverServer.exe");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
WebDriver driver = new InternetExplorerDriver(capabilities);
You should use Select Class and create object of Select class.
Select dropdown = new Select(driver.findElement(By.id("abcdefg")));
Below is Sample HTML
<html>
<body>
<select id = "Name">
<option value = "GK">Gaurav</option>
<option value = "JD"> Jaideep </option>
<option value = "AN"> Arjya </option>
</option>
</select>
<body>
</html>
To select its option say 'Gaurav' you can do
dropdown.selectByVisibleText("Gaurav");
or
dropdown.selectByIndex(1);
or
dropdown.selectByValue("GK");
2. Types of Wait in Selenium Webdriver
There are three types of wait in Selenium: a) Implicit Wait b) Explicit Wait c) Fluent Wait
a) Implicit Wait:
The purpose of Implicit wait is to wait for a set period of time before moving to next line of code
The syntax for Implicit Wait is:
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
a) Implicit Wait:
The purpose of Implicit wait is to wait for a set period of time before moving to next line of code
The syntax for Implicit Wait is:
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
3. Why We do not require the to Set System Property to Use Firefox Driver in Selenium WebDriver
Because Firefox driver is included in the selenium-server-stanalone.jar . The driver comes in the form of an xpi (firefox extension) which is added to the firefox profile when you start a new instance of FirefoxDriver.
4. How can we accept Untrusted SSL certificate in WebDriver for Chrome , IE and Firefox Browser
Firefox:
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("setAcceptUntrustedCertificates","true");
driver = new FirefoxDriver(profile);
Chrome:
System.setProperty("webdriver.chrome.driver",
"Path to ChromeDriver//chromedriver.exe");
DesiredCapabilities capability = DesiredCapabilities.chrome();
capability.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
driver = new ChromeDriver(capability);
IE:
System.setProperty("webdriver.ie.driver",
"Path to IEDriver//IEDriverServer.exe");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
WebDriver driver = new InternetExplorerDriver(capabilities);
Great blog about mobile application testing. Very much useful for freshers. Also i want you to post more articles like this. Thanks for sharing
ReplyDeleteAndroid App Development company