当前位置:网站首页>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()边栏推荐
- Unsafe and CAS principle
- Recursion and recursion
- Get current JVM data
- 2022.02.13
- Pyqt5 sensitive word detection tool production, operator's Gospel
- Summary of fluent systemchrome
- Ppt image processing
- Go error collection | talk about the difference between the value type and pointer type of the method receiver
- Current detection circuit - including op amp current scheme
- Fluent learning (4) listview
猜你喜欢

What are the common computer problems and solutions

Buuctf, misc: n solutions

Gorilla/mux framework (RK boot): add tracing Middleware

How to connect a laptop to a projector

C deep anatomy - the concept of keywords and variables # dry inventory #

Pat grade A - 1164 good in C (20 points)

Programming language (1)

Go Technology Daily (2022-02-13) - Summary of experience in database storage selection

Shiftvit uses the precision of swing transformer to outperform the speed of RESNET, and discusses that the success of Vit does not lie in attention!

A preliminary study on the middleware of script Downloader
随机推荐
在恒泰证券开户怎么样?安全吗?
Qtoolbutton - menu and popup mode
Unique in China! Alibaba cloud container service enters the Forrester leader quadrant
Cgb2201 preparatory class evening self-study and lecture content
Pyqt5 sensitive word detection tool production, operator's Gospel
Pandaoxi's video
finalize finalization finally final
Niuke winter vacation training camp 4 g (enumeration optimization, Euler power reduction)
Learning notes of raspberry pie 4B - IO communication (SPI)
Is the controller a single instance or multiple instances? How to ensure the safety of concurrency
股票开户佣金最低的券商有哪些大家推荐一下,手机上开户安全吗
Design of logic level conversion in high speed circuit
A treasure open source software, cross platform terminal artifact tabby
SDNU_ ACM_ ICPC_ 2022_ Winter_ Practice_ 4th [individual]
Meta metauniverse female safety problems occur frequently, how to solve the relevant problems in the metauniverse?
Teach you to easily learn the type of data stored in the database (a must see for getting started with the database)
Blue Bridge Cup -- Mason prime
2.14 summary
4 environment construction -standalone ha
"Learning notes" recursive & recursive