radio样式

博客展示了radio样式的代码。定义了.radio类,设置其位置、边框、圆角、尺寸和背景色;还定义了.radio.active:after伪元素,设置选中状态下的样式,代码转载自相关博客。
.radio{
position: relative;
border: 1px solid #999;
border-radius: 50%;
width: 12px;
height: 12px;
background-color: #eee;
}

.radio.active:after {
content: "";
display: table;
position: absolute;
top: 2px;
left: 2px;
width:6px;
height: 6px;
border-radius: 50%;
background-color: #666;
}

 

转载于:https://www.cnblogs.com/Nyan-Workflow-FC/p/10917060.html

### 正方教务系统自动化脚本开发教程 #### 使用 Python 和 Selenium 实现自动化的基础准备 对于希望利用 Python 和 Selenium 来创建针对正方教务系统自动化脚本而言,准备工作至关重要。这不仅涉及安装必要的库文件,还需要理解如何通过 WebDriver 控制浏览器行为以及处理网页上的各种交互事件[^1]。 ```python from selenium import webdriver import time ``` 这段简单的代码片段展示了启动 Chrome 浏览器并等待其加载完成的过程。`webdriver.Chrome()` 方法会返回一个指向新打开的 Chrome 浏览器实例的对象;而 `time.sleep(3)` 则让程序暂停三秒钟以便页面完全加载完毕再继续执行后续命令[^4]。 #### 模拟登录过程 在实际编写脚本之前,模拟登录是一个必不可少的部分。由于大多数在线服务都会采取措施防止机器人访问,因此开发者可能需要解决诸如验证码验证等问题。一种解决方案是借助第三方打码服务平台来绕过这一障碍[^2]。 ```python driver.get('http://example.com/login') # 替换为目标网站的实际地址 username_input = driver.find_element_by_name('username') password_input = driver.find_element_by_name('password') # 输入用户名密码 username_input.send_keys('your_username') password_input.send_keys('your_password') captcha_image_url = 'data:image/png;base64,' + captcha_base64_string response = requests.post('http://third-party-captcha-service', data={'image': captcha_image_url}) captcha_text = response.json()['result'] # 将获取到的结果填入表单相应位置 captcha_field = driver.find_element_by_id('captcha') captcha_field.send_keys(captcha_text) login_button.click() ``` 上述代码说明了如何找到 HTML 文档中的特定输入框,并向其中发送预设好的字符串作为用户凭证的一部分。同时,这里还包含了调用外部 API 处理图像型验证码的例子。 #### 定位程列表与提交请求 一旦成功登陆至目标站点内部,则可以通过分析页面结构进一步精确定位所需操作的目标元素——即待选修的具体科目链接或按钮。通常情况下,这些对象可通过 XPath 或 CSS Selector 进行高效选取: ```python course_selection_buttons = driver.find_elements_by_css_selector('.select-course-button-classname') for button in course_selection_buttons[:number_of_courses_to_select]: try: button.click() confirm_selection_popup = WebDriverWait(driver, 10).until( EC.presence_of_element_located((By.CSS_SELECTOR, '.confirm-selection-popup')) ) confirm_selection_popup.submit() # 假设有确认弹窗需点击确认 print(f'Successfully selected {button.text}') except Exception as e: print(f'Failed to select {button.text}: ', str(e)) ``` 此部分代码实现了遍历所有可选项并将它们逐一加入购物车的功能。注意,在某些场景下可能会遇到额外的安全机制(比如二次确认对话框),此时应适当调整策略以适应具体环境需求[^3]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值