0

I wanted to select and click one of the options as shown in this image.

https://i.sstatic.net/SWxAQ.jpg

from selenium import webdriver driver = webdriver.Chrome("C:/Users/bunai/PycharmProjects/chromedriver.exe") driver.get("https://www.tppcrpg.net/login.php") # identify username, password and signin elements driver.find_element_by_name("LoginID").send_keys("3480199") driver.find_element_by_name("NewPass").send_keys("12") driver.find_element_by_class_name("submit").click() time.sleep(1.0) driver.get("https://www.tppcrpg.net/configure_roster.php") time.sleep(0.1) driver.find_element_by_xpath("/html/body/div[@id='body']/div[@id='inner']/form/ul[@id='configure']/li[1]/p[2]/input[@id='tMoves_102787072_1']").click() time.sleep(0.1) driver.find_element_by_xpath("/html/body/div[@id='cBox']/p[@class='center'][1]/select[@id='MoveA']").click() 

I only mange to click the option but i was not able to go down and select other option. Any idea which code should be used there? Thanks

    1 Answer 1

    1

    Looks like this is a select element so this should answer your question. how-to-select-a-drop-down-menu-value-with-selenium-using-python

    from selenium.webdriver.support.select import Select # Identify dropdown with Select element = Select(driver.find_element_by_xpath("path to select element")) # Select by: element.select_by_visible_text("Text from dropdown") # Or element.select_by_index(0) # Or element.select_by_value("value from dropdown") 
    1
    • Thanks change the title. Any idea how to select the options. I only want to pick the first one there
      – Bashing
      CommentedApr 22, 2021 at 17:01

    Start asking to get answers

    Find the answer to your question by asking.

    Ask question

    Explore related questions

    See similar questions with these tags.