Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

Its very hard to answers questions like this, without being able to debug and run the test code it self, but here is a try going over your code top to bottom:

  1. Why are you using a sleep?

Thread.sleep(1000*4);

Here you want to wait for the element to be visible as describe in the post: http://software-testing-tutorials-automation.blogspot.nl/2014/02/selenium-webdriver-how-to-wait-till.html

WebDriverWait wait = new WebDriverWait(driver, 15);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.name("industrySectorsector"))));

Because maybe waiting 4 seconds is not enough when the screen is maximized, while it is when its minimized?

  1. The select the dropdown works a bit simpler according to this post: http://stackoverflow.com/questions/12940592/how-to-select-an-item-from-a-dropdown-list-using-selenium-webdriver-with-javahttps://stackoverflow.com/questions/12940592/how-to-select-an-item-from-a-dropdown-list-using-selenium-webdriver-with-java

You only need the following code:

Select dropdown = new Select(driver.findElement(By.name("industrySector-sector")));
dropdown.selectByVisibleText("Computer Software");

There is a - missing in the By.Name in your example code

I think you do not even need to click it to open, unless the onClick triggers an event to populate it.

  1. You don't need to click on the dropdown element again afterwards, this is what the selectByVisibleText function is for

  2. Also I do not see a option Computer Software in your HTML snippet, maybe its correct this option is missing?

Its very hard to answers questions like this, without being able to debug and run the test code it self, but here is a try going over your code top to bottom:

  1. Why are you using a sleep?

Thread.sleep(1000*4);

Here you want to wait for the element to be visible as describe in the post: http://software-testing-tutorials-automation.blogspot.nl/2014/02/selenium-webdriver-how-to-wait-till.html

WebDriverWait wait = new WebDriverWait(driver, 15);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.name("industrySectorsector"))));

Because maybe waiting 4 seconds is not enough when the screen is maximized, while it is when its minimized?

  1. The select the dropdown works a bit simpler according to this post: http://stackoverflow.com/questions/12940592/how-to-select-an-item-from-a-dropdown-list-using-selenium-webdriver-with-java

You only need the following code:

Select dropdown = new Select(driver.findElement(By.name("industrySector-sector")));
dropdown.selectByVisibleText("Computer Software");

There is a - missing in the By.Name in your example code

I think you do not even need to click it to open, unless the onClick triggers an event to populate it.

  1. You don't need to click on the dropdown element again afterwards, this is what the selectByVisibleText function is for

  2. Also I do not see a option Computer Software in your HTML snippet, maybe its correct this option is missing?

Its very hard to answers questions like this, without being able to debug and run the test code it self, but here is a try going over your code top to bottom:

  1. Why are you using a sleep?

Thread.sleep(1000*4);

Here you want to wait for the element to be visible as describe in the post: http://software-testing-tutorials-automation.blogspot.nl/2014/02/selenium-webdriver-how-to-wait-till.html

WebDriverWait wait = new WebDriverWait(driver, 15);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.name("industrySectorsector"))));

Because maybe waiting 4 seconds is not enough when the screen is maximized, while it is when its minimized?

  1. The select the dropdown works a bit simpler according to this post: https://stackoverflow.com/questions/12940592/how-to-select-an-item-from-a-dropdown-list-using-selenium-webdriver-with-java

You only need the following code:

Select dropdown = new Select(driver.findElement(By.name("industrySector-sector")));
dropdown.selectByVisibleText("Computer Software");

There is a - missing in the By.Name in your example code

I think you do not even need to click it to open, unless the onClick triggers an event to populate it.

  1. You don't need to click on the dropdown element again afterwards, this is what the selectByVisibleText function is for

  2. Also I do not see a option Computer Software in your HTML snippet, maybe its correct this option is missing?

added 34 characters in body
Source Link

Its very hard to answers questions like this, without being able to debug and run the test code it self, but here is a try going over your code top to bottom:

  1. Why are you using a sleep?

Thread.sleep(1000*4);

Here you want to wait for the element to be visisblevisible as describe in the post: http://software-testing-tutorials-automation.blogspot.nl/2014/02/selenium-webdriver-how-to-wait-till.html

WebDriverWait wait = new WebDriverWait(driver, 15);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.name("industrySectorsector"))));

Because maybe waiting 4 seconds is not enough when the screen is maximized, while it is when its minimized?

  1. Also to select the dropdown works a bit simpler according to this post: http://stackoverflow.com/questions/12940592/how-to-select-an-item-from-a-dropdown-list-using-selenium-webdriver-with-java

    Select dropdown = new Select(driver.findElement(By.name("industrySector-sector"))); dropdown.selectByVisibleText("Computer Software");

  2. There is a - missing in the By.Name in your example code

  3. You don't need to click on the dropdown element again afterwards, this is what the selectByVisibleText function is for, I think you do not even need to click it to open, unless the onClick triggers an event to populate it.

  4. Also I do not see a option Computer Software in your HTML snippet, maybe its correct this option is missing?

    The select the dropdown works a bit simpler according to this post: http://stackoverflow.com/questions/12940592/how-to-select-an-item-from-a-dropdown-list-using-selenium-webdriver-with-java

You only need the following code:

Select dropdown = new Select(driver.findElement(By.name("industrySector-sector")));
dropdown.selectByVisibleText("Computer Software");

There is a - missing in the By.Name in your example code

I think you do not even need to click it to open, unless the onClick triggers an event to populate it.

  1. You don't need to click on the dropdown element again afterwards, this is what the selectByVisibleText function is for

  2. Also I do not see a option Computer Software in your HTML snippet, maybe its correct this option is missing?

Its very hard to answers questions like this, without being able to debug and run the test code it self, but here is a try going over your code top to bottom:

  1. Why are you using a sleep?

Thread.sleep(1000*4);

Here you want to wait for the element to be visisble as describe in the post: http://software-testing-tutorials-automation.blogspot.nl/2014/02/selenium-webdriver-how-to-wait-till.html

WebDriverWait wait = new WebDriverWait(driver, 15);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.name("industrySectorsector"))));

Because maybe waiting 4 seconds is not enough when the screen is maximized, while it is when its minimized?

  1. Also to select the dropdown works a bit simpler according to this post: http://stackoverflow.com/questions/12940592/how-to-select-an-item-from-a-dropdown-list-using-selenium-webdriver-with-java

    Select dropdown = new Select(driver.findElement(By.name("industrySector-sector"))); dropdown.selectByVisibleText("Computer Software");

  2. There is a - missing in the By.Name in your example code

  3. You don't need to click on the dropdown element again afterwards, this is what the selectByVisibleText function is for, I think you do not even need to click it to open, unless the onClick triggers an event to populate it.

  4. Also I do not see a option Computer Software in your HTML snippet, maybe its correct this option is missing?

Its very hard to answers questions like this, without being able to debug and run the test code it self, but here is a try going over your code top to bottom:

  1. Why are you using a sleep?

Thread.sleep(1000*4);

Here you want to wait for the element to be visible as describe in the post: http://software-testing-tutorials-automation.blogspot.nl/2014/02/selenium-webdriver-how-to-wait-till.html

WebDriverWait wait = new WebDriverWait(driver, 15);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.name("industrySectorsector"))));

Because maybe waiting 4 seconds is not enough when the screen is maximized, while it is when its minimized?

  1. The select the dropdown works a bit simpler according to this post: http://stackoverflow.com/questions/12940592/how-to-select-an-item-from-a-dropdown-list-using-selenium-webdriver-with-java

You only need the following code:

Select dropdown = new Select(driver.findElement(By.name("industrySector-sector")));
dropdown.selectByVisibleText("Computer Software");

There is a - missing in the By.Name in your example code

I think you do not even need to click it to open, unless the onClick triggers an event to populate it.

  1. You don't need to click on the dropdown element again afterwards, this is what the selectByVisibleText function is for

  2. Also I do not see a option Computer Software in your HTML snippet, maybe its correct this option is missing?

Source Link

Its very hard to answers questions like this, without being able to debug and run the test code it self, but here is a try going over your code top to bottom:

  1. Why are you using a sleep?

Thread.sleep(1000*4);

Here you want to wait for the element to be visisble as describe in the post: http://software-testing-tutorials-automation.blogspot.nl/2014/02/selenium-webdriver-how-to-wait-till.html

WebDriverWait wait = new WebDriverWait(driver, 15);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.name("industrySectorsector"))));

Because maybe waiting 4 seconds is not enough when the screen is maximized, while it is when its minimized?

  1. Also to select the dropdown works a bit simpler according to this post: http://stackoverflow.com/questions/12940592/how-to-select-an-item-from-a-dropdown-list-using-selenium-webdriver-with-java

    Select dropdown = new Select(driver.findElement(By.name("industrySector-sector"))); dropdown.selectByVisibleText("Computer Software");

  2. There is a - missing in the By.Name in your example code

  3. You don't need to click on the dropdown element again afterwards, this is what the selectByVisibleText function is for, I think you do not even need to click it to open, unless the onClick triggers an event to populate it.

  4. Also I do not see a option Computer Software in your HTML snippet, maybe its correct this option is missing?