I am working on automation, while automating a form with number of drop-down's.
The problem with me is, when run the code in maximize mode of window it gives me an Error:
org.openqa.selenium.NoSuchElementException: Cannot locate element with text: Computers
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:03:00' System info: host: 'Rajesh-PC', ip: '192.168.0.120', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_31' Driver info: driver.version: unknown
It touches the drop-down but the value is not being clicked.
But when I run same code in minimized window it execute all code successfully without any error, please go-through code of one drop-drown.
driver.findElement(By.name("industrySector-sector")).click();
Thread.sleep(1000*4);
new Select(driver.findElement(By.name("industrySectorsector"))). selectByVisibleText("Computer Software");
driver.findElement(By.cssSelector("select[name=\"industrySector-sector\"] > option[value=\"Computer Software\"]")).click();
HTML code:
<div id="industrySectorFilter" class="custom-select select-width" name="select-type">
<select class="" name="industrySector-sector">
<option value="0">Industry Sector * </option>
<option data-type="43" data-id="1" value="Accounting - Finance">Accounting - Finance</option>
<option data-type="43" data-id="2" value="Advertising">Advertising</option>
<option data-type="43" data-id="3" value="Agriculture">Agriculture</option>
<option data-type="43" data-id="4" value="Airline - Aviation">Airline - Aviation</option>
<option data-type="43" data-id="5" value="Appliance">Appliance</option>
<option data-type="43" data-id="7" value="Architecture - Building">Architecture - Building</option>
<option data-type="43" data-id="8" value="Art - Photography - Journalism">Art - Photography - Journalism</option>
</select>
</div>