当前位置:网站首页>Selenium check box
Selenium check box
2022-07-03 23:10:00 【thorne_】
Take Sina Weibo registration page as an example , Check the individual check boxes : Check here ‘ Journalism ’ Check box as an example
Code ideas : By positioning the check box xpth, And then click .
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
driver.get("https://login.sina.com.cn/signup/signup?entry=homepage") # Sina registration page
element = driver.find_element(By.XPATH,'//*[@id="phone-form"]/div[4]/div[2]/label[1]/input').click()
Check all check boxes : Locate through the same attribute of each check box , And then click
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
driver.get("https://login.sina.com.cn/signup/signup?entry=homepage")
# Find the same attribute for each check box element
elements = driver.find_elements(By.NAME,'hobbies[]')
for element in elements:
element.click()
边栏推荐
- How to quickly build high availability of service discovery
- The difference between SRAM and DRAM
- 2 spark environment setup local
- Programming language (2)
- How to restore the factory settings of HP computer
- [Android reverse] use the DB browser to view and modify the SQLite database (copy the database file from the Android application data directory | use the DB browser tool to view the data block file)
- User login function: simple but difficult
- Hcip day 15 notes
- Opengauss database log management guide
- Summary of fluent systemchrome
猜你喜欢
Schematic diagram of crystal oscillator clock and PCB Design Guide
Fluent learning (4) listview
BUUCTF,Misc:LSB
The difference between SRAM and DRAM
[Android reverse] application data directory (files data directory | lib application built-in so dynamic library directory | databases SQLite3 database directory | cache directory)
Interpretation of corolla sub low configuration, three cylinder power configuration, CVT fuel saving and smooth, safety configuration is in place
Sort merge sort
3 environment construction -standalone
Teach you to easily learn the type of data stored in the database (a must see for getting started with the database)
Pyqt5 sensitive word detection tool production, operator's Gospel
随机推荐
Buuctf, misc: sniffed traffic
LeetCode 540. A single element in an ordered array
Fluent learning (4) listview
Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?
Introduction to the gtid mode of MySQL master-slave replication
Pyqt5 sensitive word detection tool production, operator's Gospel
Buuctf, web:[geek challenge 2019] buyflag
User login function: simple but difficult
Text replacement demo
Cgb2201 preparatory class evening self-study and lecture content
[Android reverse] use DB browser to view and modify SQLite database (download DB browser installation package | install DB browser tool)
LeetCode 1646. Get the maximum value in the generated array
Yyds dry goods inventory Spring Festival "make" your own fireworks
Unique in China! Alibaba cloud container service enters the Forrester leader quadrant
The overseas listing of Shangmei group received feedback, and brands such as Han Shu and Yiye have been notified for many times and received attention
Bufferpool caching mechanism for executing SQL in MySQL
Maxwell equation and Euler formula - link
Recursive least square adjustment
Arc135 partial solution
炒股开户佣金优惠怎么才能获得,网上开户安全吗