Troubles with drop-down automation - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html) +--- Thread: Troubles with drop-down automation (/thread-11393.html) |
Troubles with drop-down automation - knowledge1st - Jul-06-2018 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" : <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... |