python - 如何在 Chrome 选项 python selenium 中通过 xpath 找到元素
问题描述
我面临着一些困难,(它还没有完成)
import webbrowser
import time
url1 = 'https://www.youtube.com/watch?v=W8KRzm-HUcc'
chrome_path = r'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'
webbrowser.register('chrome', None, webbrowser.BackgroundBrowser(chrome_path))
webbrowser.get('chrome').open_new_tab(url1)
time.sleep(12)***.find_element_by_xpath('//*[@id="search"]').click()***
如何在不编写“Driver.find_element_by_xpath”的情况下通过 xpath 找到元素,因为每当我不使用“Driver.find_element_by_xpath”时,我都会收到此错误:
**attributeerror 'nonetype' object has no attribute 'find_element_by_xpath'**
感谢您的帮助,我是编码新手,但我仍然没有得到一些东西......
解决方案
推荐阅读
- node.js - 如何从 Node、express、Mongoose 和 Ajax 上的帖子中删除评论
- python - 用于计算数字在几个月内增加的 Python 代码,如果它每月增加 10%
- scala - 在 pureconfig 中表示 Either
- scala - 如何为 monaco 编辑器添加 scala 语言支持
- neo4j - 是否可以通过某些属性返回具有关系的节点?
- c - 获取以逗号分隔的输入 + 获取输入的问题
- node.js - 如何更新 npm 版本?
- php - 如何将在 Docker 中运行的安全 PHP 源代码绑定到特定的 IP 或 MAC 地址?
- python - 根据其他数组从 numpy 数组中选择值
- quarkus - quarkus panache 和 postgresql 序列错误