简体   繁体   中英

What do i do if Selenium taking more time in case value is not present in dropdown?

I am trying to select values from a Drop down list,but in current build one list item is removed and in code i've mentioned removed list item name.While executing selenium script,it is taking more time,instead of any exception,below is my code.

WebElement mySelectElement = driver.findElement(By.id("mySelect"));
Select dropdown= new Select(mySelectElement);
dropdown.selectByValue("HomeAdderess")

What should i do in this case?

  1. I think an implicit wait is set for a large amount( ie 30,40 or 60 seconds). You can simply reduce the time by setting implicit wait.

    driver.manage().timeouts().implicitlyWait(5,TimeUnit.SECONDS) ;

It will only wait for 5 seconds.

  1. Or you can skip the test as suggested above by DebanjanB.

You can create a different wait variable for these kind of tests. Or you can write a custom method to handle it verifyElementNotPresentOnDropdown()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM