Jul-06-2018, 03:53 PM
I'm having some troubles with clicking a item in a drop-down menu/list..
I'm using Selenium Web Driver, Chrome specifically, and i have the next "button" :
Can't use smh like:
I figured a way to click by xPath but, it doesn't work to me, cause text1, text2, text3 and so changes the order everytime you open the web
What i need to do here, is to iterate trough each item, and select the one that match with "text1", "text2" or "text3...
I'm using Selenium Web Driver, Chrome specifically, and i have the next "button" :
<button id="btn" class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-expanded="false">Nope</button> <ul id="ulDropdownNivel2" class="dropdown-menu"> <li> <a href="#">text1</a> </li> <li> <a href="#">text2</a> </li> <li> <a href="#">text3</a> </li> </ul>So.. i have tried to use Select.class of Selenium Wd but, it's a button, and the class can't be used there... tried using it on the <ul> but it can't use Select neither...
Can't use smh like:
dropdoun = Select(driver.find_element_by_id('ID')) for elm in dropdoun{ print(elm.text())}Tried to figure a way to iterate through items... but i didn't get anything
I figured a way to click by xPath but, it doesn't work to me, cause text1, text2, text3 and so changes the order everytime you open the web
What i need to do here, is to iterate trough each item, and select the one that match with "text1", "text2" or "text3...