问题
I am trying to click on an object within the iframe, but I can't switch frames for some reason.
This is the code that I am using to switch frames:
driver.switch_to.frame(frame_reference=driver.find_elements_by_xpath('//*
[@id="practice_schedule"]'))
This is the HTML path:
Any solutions?
回答1:
.find_elements_by_xpath return list, remove s from it, what you want is .find_element_by_xpath to select first element.
来源:https://stackoverflow.com/questions/53627122/how-to-switch-to-iframe-not-working-in-selenium