How to switch to iFrame, not working in Selenium

若如初见. 提交于 2019-12-11 15:54:49

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!