selenium+edge
时间: 2023-09-03 14:05:36 浏览: 144
Selenium 4内置支持Microsoft Edge,因此如果使用Selenium 4,就不需要使用Selenium Tools for Microsoft Edge。然而,如果仍然使用Selenium 3,可以按照以下步骤将Selenium Tools for Microsoft Edge和Selenium 3添加到项目中。
在Selenium 4中使用Microsoft Edge的示例代码如下:
```python
from selenium.webdriver import Edge
from selenium.webdriver.edge.options import Options as EdgeOptions
url = "https://www.baidu.com/"
options = EdgeOptions()
options.add_argument("headless")
browser = Edge(executable_path='../Driver/msedgedriver.exe', options=options)
browser.get(url=url)
print(browser.title)
```
以上代码演示了如何在Python中使用Selenium 4和Microsoft Edge进行无界面浏览,并打印出页面的标题。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* *3* [Python selenium配置Edge](https://blog.csdn.net/qq_45604582/article/details/122450632)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"]
[ .reference_list ]
阅读全文