how to fetch the list of values from radio button?

  • I am working on selenium and python. I am unable to select the radio button. I want to add the values in a list. and iterate and click on the specific radio button.

     def test_search_in_python_org(self):
            driver = self.driver
            driver.find_element_by_xpath("//a[normalize-space()='ROUND TRIP']").click()

    enter image description here


    selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//a[normalize-space()='ROUND TRIP']"}

  • I don't think you need to iterate through them.

    Just target the correct element, your xpath could look like this:


    One of the problems with your current xpath is you're trying to find an 'a' element, where the fake radio buttons are actually 'li' elements.

Suggested Topics