0

In a constantly updated listbox, I have to select the first tile each time.

enter image description here

This list will be constantly updated and I have to regularly click on the first option.

 WebDriverWait(driver,30).until(EC.element_to_be_clickable((By.CLASS_NAME,"dual-listbox__available"))).click()

I can't get a response from your code.

1 Answers1

0

In the above code, you can get the first element by a CssSelector. Find the google chrome extension SelectorsHub so you can get the CssSelector easily which will solve your problem.

pr96
  • 994
  • 5
  • 17
  • Not working. I select that item and take it elsewhere, and when the list is refreshed, it doesn't work when I want to buy the first item again. – Beytullah AY Nov 25 '22 at 19:08
  • Try these references: [Ref1](https://stackoverflow.com/questions/38953198/xpath-to-select-first-element-in-a-dropdown-list) [Ref2](https://stackoverflow.com/questions/1006283/how-to-select-the-first-element-with-a-specific-attribute-using-xpath) – pr96 Nov 26 '22 at 13:47