在Python中使用Selenium在iframe中单击按钮

问题描述

我正在使用带有Selenium和Python的Chrome扩展程序INSSIST自动执行Instagram Story。

我已使用Xpath选择了iframe,然后切换到该框架。我尝试了“单击并悬停”以单击按钮,但没有任何效果。为什么我无法单击按钮类?而我该怎么办呢?

#Iframe Switch
q=driver.find_element_by_xpath('//*[@id="app"]/div[1]/div[2]/div[2]/div[1]/div[2]/div/div/div[3]/iframe')
driver.switch_to.frame(q)
#Clicking  
story=driver.find_element_by_xpath('//*[@id="react-root"]/section/nav[1]/div/div/header/div/div[1]/button')
story.click() #not working

#Hovering
hover = ActionChains(driver).move_to_element(story)
hover.perform() #not working 

Full Code files

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)