how to select an option from dropdown in selenium where element is not select code example
Example 1: dropdown in selenium
it depends what kind of dropdown
There are 2 dropdowns
1- HTML
2- SELECT
we determine what kind of dropdown it is
-By tagName.We inspect.If it has
Example 2: select statement in selenium
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class MyClass {
public static void main(String[] args) {
String baseUrl = "http://demo.guru99.com/test/link.html";
System.setProperty("webdriver.chrome.driver","G:\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get(baseUrl);
driver.findElement(By.linkText("click here")).click();
System.out.println("title of page is: " + driver.getTitle());
driver.quit();
}
}