Posts

Basic Selenium Interview Question Part - 1

How to handle autocomplete box in web driver? driver.findElement(By.id("your searchBox")).sendKeys("your partial keyword"); Thread.sleep(3000); List< WebElement> listItems = driver.findElements(By.xpath("your list item locator")); listItems.get(0).click(); driver.findElement(By.id("your searchButton")).click(); How to handle colors in web driver? Use getCssValue(arg0) function to get the colors by sending 'color' string as an argument. Example String col = driver.findElement(By.id(locator)).getCssValue("color"); How to change user agent in Firefox by selenium web driver. FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("general.useragent.override", "some UA string"); Web Driver driver = new FirefoxDriver(profile); How to work with radio button in web driver? We can select the value from the drop down by using 3 methods. selectByVisib...