selenium webdriver for edge
时间: 2023-08-06 20:06:21 浏览: 121
To use Selenium WebDriver with Microsoft Edge, you need to download and install the appropriate driver. Follow the steps below:
1. Visit the Microsoft WebDriver page: https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
2. Scroll down to the "Downloads" section and download the appropriate version of the WebDriver for your installed version of Edge.
3. Extract the downloaded file to a location on your computer.
4. In your Selenium WebDriver code, specify the path to the extracted WebDriver executable.
Here's an example of how you can set up Selenium WebDriver for Edge in Python:
```python
from selenium import webdriver
# Set the path to the Microsoft WebDriver executable
edge_driver_path = "path/to/extracted/driver/msedgedriver.exe"
# Create a new instance of the Edge WebDriver
driver = webdriver.Edge(executable_path=edge_driver_path)
# Use the driver to automate your tests
# ...
# Close the browser when done
driver.quit()
```
Make sure to replace `"path/to/extracted/driver/msedgedriver.exe"` with the actual path to the extracted WebDriver executable on your machine.
Note: Ensure that you have the appropriate version of the WebDriver for your installed version of Microsoft Edge.
阅读全文