当前位置:网站首页>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()
边栏推荐
- HALCON联合C#检测表面缺陷——HALCON例程autobahn
- 从零开始的基于百度大脑EasyData的多人协同数据标注
- GoLand 2021.1: rename the go project
- Uniapp tips - set background music
- Flutter dynamic | fair 2.5.0 new version features
- 金属有机骨架材料ZIF-8包载姜黄素([email protected]纳米颗粒)|纳米金属有机框架搭载雷帕霉素|科研试剂
- KEIL5出现中文字体乱码的解决方法
- page owner特性浅析
- How to promote the progress of project collaboration | community essay solicitation
- Go language web development series 28: solve cross domain access of CORS with gin contrib / CORS
猜你喜欢

Implementation of Muduo accept connection, disconnection and sending data

Golang — 命令行工具cobra

Golang - command line tool Cobra
![[how to solve FAT32 when the computer is inserted into the U disk or the memory card display cannot be formatted]](/img/95/09552d33d2a834af4d304129714775.png)
[how to solve FAT32 when the computer is inserted into the U disk or the memory card display cannot be formatted]

Go language web development series 28: solve cross domain access of CORS with gin contrib / CORS

SQL Injection (GET/Select)

挡不住了,国产芯片再度突进,部分环节已进到4nm

Use docker to build sqli lab environment and upload labs environment, and the operation steps are provided with screenshots.

CVPR 2022 | interpretation of 6 excellent papers selected by meituan technical team
![[机缘参悟-37]:人感官系统的结构决定了人类是以自我为中心](/img/06/b71b505c7072d540955fda6da1dc1b.jpg)
[机缘参悟-37]:人感官系统的结构决定了人类是以自我为中心
随机推荐
Uniapp tips - scrolling components
RichView TRVStyle ListStyle 列表样式(项目符号编号)
Bidirectional linked list (we only need to pay attention to insert and delete functions)
[技术发展-24]:现有物联网通信技术特点
Leetcode-1175. Prime Arrangements
Qt学习20 Qt 中的标准对话框(中)
Golang — 命令行工具cobra
Brief analysis of tensorboard visual processing cases
【BW16 应用篇】安信可BW16模组与开发板更新固件烧录说明
[redis] cache warm-up, cache avalanche and cache breakdown
PHP maze game
[combinatorics] permutation and combination (two counting principles, examples of set permutation | examples of set permutation and circle permutation)
解决MySql 1045 Access denied for user ‘root‘@‘localhost‘ (using password: YES)
RocksDB LRUCache
Halcon combined with C # to detect surface defects -- Halcon routine autobahn
Flutter动态化 | Fair 2.5.0 新版本特性
金属有机骨架材料ZIF-8包载姜黄素([email protected]纳米颗粒)|纳米金属有机框架搭载雷帕霉素|科研试剂
[technology development-24]: characteristics of existing IOT communication technology
[quantitative trading] permanent portfolio, turtle trading rules reading, back testing and discussion
Go language unit test 4: go language uses gomonkey to test functions or methods