1

URL = https://www.sephora.com/search?keyword=shaving
At the bottom of the page, I'm trying to change from "View 60" to "View All". The problem is that test case passed successfully, but the browser doesn't change it from "60" to "All".
I'm using this code:

from selenium.webdriver.support.ui import Select
element = self.driver.find_element_by_xpath("//*[@class='css-bpk111']")
dropdown = Select(element)
dropdown.select_by_value("300")

I used "mouse over", tried to click on it. Nothing worked. What seems to be the problem?

asked Sep 27, 2019 at 14:43

1 Answer 1

-1

Sometimes selenium is just too fast. You can try putting a sleep thread

dropdown = Select(element)
time.sleep(2.4)
dropdown.select_by_value("300")

Or, you could try to select by index

https://www.guru99.com/select-option-dropdown-selenium-webdriver.html

**Edited to change C# to python

answered Sep 27, 2019 at 16:25
2
  • This not valid Python code - Thread.Sleep is not part of the language. Commented Sep 27, 2019 at 18:55
  • StarKill3r, I used select_by_index, still nothing. I also used time.sleep(10), zero effect. Commented Sep 28, 2019 at 8:16

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.