当前位置:网站首页>Selenium browser (1)
Selenium browser (1)
2022-07-03 13:56:00 【Live up to your youth】
summary
Selenium Support all major browsers on the market , Such as Chrome、Firefox、Internet Explorer、Edge、Opera and Safari.WebDriver Try to use the built-in automation support of the browser to drive the browser .
selenium The operation of the browser mainly includes opening and closing the browser , Get browser information ( Such as the title 、 Website, etc ), Locate the elements in the web page , Remote control browser, etc , among , The most important part is to locate the elements in the web page .
function
Open the browser
1、 open Chrome browser . Be careful , Chrome The browser and chromedriver The version of must match the main version .
options = ChromeOptions()
driver = webdriver.Chrome(options=options)
2、 open Edge browser . And Chrome similar , edgedriver The major version number of must be the same as Edge The major version of the browser matches .
options = EdgeOptions()
driver = webdriver.Edge(options=options)
3、 open Firefox browser .
options = FirefoxOptions()
driver = webdriver.Firefox(options=options)
4、 open Internet Explorer browser .
options = IEOptions()
driver = webdriver.Ie(options=options)
have access to IE Driver in IE Use Microsoft in compatibility mode Edge.
options = IEOptions()
options.attach_to_edge_chrome = True
options.edge_executable_path = "/path/to/edge/browser"
driver = webdriver.Ie(options=options)
5、 open Opera browser . because opera The driver does not support w3c grammar , But based on Chrome, Therefore, it is recommended to use chromedriver drive opera browser . With all the Chromium To achieve the same , Make sure the browser version matches the driver version .
options = ChromeOptions()
options.binary_location = "path/to/opera/browser"
driver = webdriver.Chrome(options=options)
6、 open Safari browser . And Chromium and Firefox The driver is different ,safaridriver It is installed with the operating system . To be in Safari Enable automation on , Run the following command from the command line :
safaridriver --enable
Then open the browser through the following code .
driver = webdriver.Safari()
Close the browser
When you finish your browser session , You should call quit sign out . Exiting will close all and WebDriver Session related windows and tabs 、 End browser process 、 End the background driver process 、 notice Selenium Grid The browser is no longer used , So that it can be used by another session ( If you are using Selenium Grid).
driver.quit()
边栏推荐
- Go language web development series 27: Gin framework: using gin swagger to implement interface documents
- Richview trvstyle liststyle list style (bullet number)
- Flutter动态化 | Fair 2.5.0 新版本特性
- [combinatorics] permutation and combination (two counting principles, examples of set permutation | examples of set permutation and circle permutation)
- MySQL data processing value addition, deletion and modification
- Go language web development series 28: solve cross domain access of CORS with gin contrib / CORS
- Halcon combined with C # to detect surface defects -- Halcon routine autobahn
- Qt学习20 Qt 中的标准对话框(中)
- pytorch 载入历史模型时更换gpu卡号,map_location设置
- 金属有机骨架MIL-88负载阿霉素DOX|叶酸修饰UiO-66-NH2负载阿霉素[email protected]纳米粒子
猜你喜欢
核酸修饰的金属有机框架药物载体|PCN-223金属有机骨架包载Ad金刚烷|ZIF-8包裹阿霉素(DOX)
Mysql:insert date:SQL 错误 [1292] [22001]: Data truncation: Incorrect date value:
又一个行业被中国芯片打破空白,难怪美国模拟芯片龙头降价抛售了
Complete DNN deep neural network CNN training with tensorflow to complete image recognition cases
Unable to stop it, domestic chips have made another breakthrough, and some links have reached 4nm
Qt学习20 Qt 中的标准对话框(中)
Mysql:insert date:sql error [1292] [22001]: data truncation: incorrect date value:
太阳底下无新事,元宇宙能否更上层楼?
解决MySql 1045 Access denied for user ‘root‘@‘localhost‘ (using password: YES)
Use vscode to view hex or UTF-8 codes
随机推荐
Heap structure and heap sort heapify
Golang — template
CVPR 2022 | interpretation of 6 excellent papers selected by meituan technical team
Thrift threadmanager and three monitors
JS general form submission 1-onsubmit
Go language web development series 27: Gin framework: using gin swagger to implement interface documents
[技术发展-24]:现有物联网通信技术特点
GoLand 2021.2 configure go (go1.17.6)
Flutter dynamic | fair 2.5.0 new version features
GoLand 2021.1.1: configure the multi line display of the tab of the open file
Resource Cost Optimization Practice of R & D team
又一个行业被中国芯片打破空白,难怪美国模拟芯片龙头降价抛售了
[développement technologique - 24]: caractéristiques des technologies de communication Internet des objets existantes
Go language unit test 4: go language uses gomonkey to test functions or methods
栈应用(平衡符)
记录关于银行回调post请求405 问题
Unity render streaming communicates with unity through JS
Implementation of Muduo accept connection, disconnection and sending data
实现CNN图像的识别和训练通过tensorflow框架对cifar10数据集等方法的处理
3D vision - 2 Introduction to pose estimation - openpose includes installation, compilation and use (single frame, real-time video)