Search code examples
pythonpython-3.xseleniumselenium-chromedriverhelper

Selenium Python options click


I want help in a little thing, Look this:

enter image description here

I want to press the option named Boleto Bancario, but look the html

enter image description here

Than how I will press the second option with selenium PYTHON


Solution

  • Please Check the snippet.

    1. You can select by value
    from selenium import webdriver
    from selenium.webdriver.support.ui import Select
    driver = webdriver.Chrome(r'chromedriver.exe')
    driver.get('url')
    sct = Select(driver.find_element_by_id('idFormaPagamento'))
    
    sct.select_by_value('813640')
    
    1. You can select by index
    sct.select_by_index('1')