我目前正在使用python并使用root,但遇到了问题,现在我陷入了困境。我似乎无法站稳脚跟。
我尝试过
#root5 = shadow_root4.find_element_by_tag_selector('settings-on-startup-page')
#root5 = shadow_root4.find_element_by_id('settings-on-startup-page')
#root5 = shadow_root4.find_element_by_name('settings-on-startup-page')
#root5 = shadow_root4.find_element_by_xpath('//*[@id="basicPage"]/settings-section[6]/settings-on-startup-page')
#root5 = shadow_root4.find_element_by_link_text('settings-on-startup-page')
#root5 = shadow_root4.find_element_by_partial_link_text('settings-on-startup-page')
#root5 = shadow_root4.find_element_by_tag_name('settings-on-startup-page')
#root5 = shadow_root4.find_element_by_class_name('settings-on-startup-page')
#root5 = shadow_root4.find_element_by_css_selector('settings-on-startup-page')
#shadow_root5 = expand_shadow_element(root5)
都失败了,通常按标签通常一直工作到现在。
root1 = cdriver.find_element_by_tag_name('settings-ui')
shadow_root1 = expand_shadow_element(root1)
root2 = shadow_root1.find_element_by_id('main')
shadow_root2 = expand_shadow_element(root2)
错误消息一直在说:消息:没有这样的元素:无法找到元素:{“方法”:“ css选择器”,“选择器”:“启动页面设置”,并扩展了先前的影子根目录那就是我可以选择的唯一一个。
root3 = shadow_root2.find_element_by_tag_name('settings-basic-page')
shadow_root3 = expand_shadow_element(root3)
root4 = shadow_root3.find_element_by_css_selector('[section = "onStartup"]')
shadow_root4 = expand_shadow_element(root4)