当前位置:网站首页>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()
边栏推荐
- Depth and breadth first traversal of tree (regardless of binary tree)
- UiO-66-COOH装载苯达莫司汀|羟基磷灰石( HA) 包裹MIL-53(Fe)纳米粒子|装载黄芩苷锰基金属有机骨架材料
- Rasp implementation of PHP
- Golang — 命令行工具cobra
- Record 405 questions about bank callback post request
- Complete DNN deep neural network CNN training with tensorflow to complete image recognition cases
- 3D vision - 2 Introduction to pose estimation - openpose includes installation, compilation and use (single frame, real-time video)
- 金属有机骨架(MOFs)抗肿瘤药载体|PCN-223装载甲硝唑|UiO-66包载盐酸环丙沙星([email protected])
- Disruptor -- a high concurrency and high performance queue framework for processing tens of millions of levels
- Students who do not understand the code can also send their own token, which is easy to learn BSC
猜你喜欢

The latest BSC can pay dividends. Any B usdt Shib eth dividend destruction marketing can

Mobile phones and computers can be used, whole people, spoof code connections, "won't you Baidu for a while" teach you to use Baidu

又一个行业被中国芯片打破空白,难怪美国模拟芯片龙头降价抛售了

使用tensorflow进行完整的DNN深度神经网络CNN训练完成图片识别案例

Comprehensively develop the main channel of digital economy and digital group, and actively promote the utonmos digital Tibet market

GoLand 2021.1.1: configure the multi line display of the tab of the open file

Uniapp tips - scrolling components
![[quantitative trading] permanent portfolio, turtle trading rules reading, back testing and discussion](/img/3b/28327bbf5eb19254f03500a41e2adb.jpg)
[quantitative trading] permanent portfolio, turtle trading rules reading, back testing and discussion

KEIL5出现中文字体乱码的解决方法

Go language unit test 5: go language uses go sqlmock and Gorm to do database query mock
随机推荐
Qt学习22 布局管理器(一)
The shadow of the object at the edge of the untiy world flickers, and the shadow of the object near the far point is normal
Go 1.16.4: manage third-party libraries with Mod
[développement technologique - 24]: caractéristiques des technologies de communication Internet des objets existantes
Uniapp tips - set background music
[ACNOI2022]猜数
核酸修饰的金属有机框架药物载体|PCN-223金属有机骨架包载Ad金刚烷|ZIF-8包裹阿霉素(DOX)
使用Tensorflow进行完整的深度神经网络CNN训练完成图片识别案例2
MIL-100( Fe) 包裹小分子阿司匹林形成[email protected](Fe)|甘草次酸修饰金属有机框架材料UiO-66-NH2(简称UiO-66-NH2-GA)
Software testing is so hard to find, only outsourcing offers, should I go?
Go language web development series 27: Gin framework: using gin swagger to implement interface documents
从零开始的基于百度大脑EasyData的多人协同数据标注
JS general form submission 1-onsubmit
The solution of Chinese font garbled code in keil5
太阳底下无新事,元宇宙能否更上层楼?
怎样删除对象的某个属性或⽅法
3D vision - 2 Introduction to pose estimation - openpose includes installation, compilation and use (single frame, real-time video)
金属有机骨架MOFs装载非甾体类抗炎药物|ZIF-8包裹普鲁士蓝负载槲皮素(制备方法)
又一个行业被中国芯片打破空白,难怪美国模拟芯片龙头降价抛售了
Richview trvstyle liststyle list style (bullet number)