how to select radio button in twitter by selenium webdriver with python?

164 Views Asked by At

select radio button in twitter such as picture below by selenium webdriver with python?

enter image description here

2

There are 2 best solutions below

0
On BEST ANSWER

If you open the developer tools of the twitter page, you can see that the dialog contains an iframe (id = "new-report-flow-frame"). You should first switch to that iframe before searching for a radio button

driver.switch_to.frame(driver.find_element_by_id("new-report-flow-frame"))
driver.find_element_by_css_selector("[value='illegal_product']")

enter image description here

0
On

You should first switch to popup window with something like

driver.switch_to_window(driver.window_handles[1])