当前位置:网站首页>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()边栏推荐
- [issue 16] golang's one-year experience in developing Purdue Technology
- C3p0 connection MySQL 8.0.11 configuration problem
- Hcip day 15 notes
- Yyds dry goods inventory [practical] simply encapsulate JS cycle with FP idea~
- Teach you how to run two or more MySQL databases at the same time in one system
- Unity shader visualizer shader graph
- LeetCode 1646. Get the maximum value in the generated array
- Apple released a supplementary update to MacOS Catalina 10.15.5, which mainly fixes security vulnerabilities
- Why should enterprises do more application activities?
- Niuke winter vacation training camp 4 g (enumeration optimization, Euler power reduction)
猜你喜欢

SDMU OJ#P19. Stock trading

Qtoolbutton - menu and popup mode

Buuctf, misc: n solutions

Opengauss database log management guide

Sort merge sort

Fluent learning (5) GridView

How to understand the gain bandwidth product operational amplifier gain
![[template summary] - binary search tree BST - Basics](/img/78/782129abea06c8e3bef69a121cbce0.jpg)
[template summary] - binary search tree BST - Basics

2022.02.14

Es6~es12 knowledge sorting and summary
随机推荐
How to connect a laptop to a projector
Comparable interface and comparator interface
Simple solution of m3u8 file format
Errors taken 1 Position1 argument but 2 were given in Mockingbird
2022.02.13
How to quickly build high availability of service discovery
Blue Bridge Cup -- Mason prime
2.14 summary
Shell script three swordsman awk
Unity shader visualizer shader graph
1068. Consolidation of ring stones (ring, interval DP)
SDNU_ ACM_ ICPC_ 2022_ Winter_ Practice_ 4th [individual]
Cgb2201 preparatory class evening self-study and lecture content
IDENTITY
Label coco format data and format data in the upper left corner and lower right corner are mutually converted
LeetCode 540. A single element in an ordered array
股票开户佣金最低的券商有哪些大家推荐一下,手机上开户安全吗
Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?
Hcip day 12 notes
4 environment construction -standalone ha