浦东美食鉴赏

import time

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select

# 创建 WebDriver 对象,指明使用chrome浏览器驱动 设置隐藏等待
wd = webdriver.Chrome(service=Service(r'chromedriver.exe'))
wd.implicitly_wait(60)

# 调用WebDriver 对象的get方法 可以让浏览器打开指定网址
wd.get('https://cas.paas.lixin.edu.cn/dist/')

# 关闭提示
tips = wd.find_element(By.CSS_SELECTOR, "[class='layui-layer-ico layui-layer-close layui-layer-close1']")
tips.click()

# 进入每日一报系统
Report = wd.find_element(By.XPATH, '//*[@id="app"]/div/div[1]/div[3]/div[2]/div[2]/div[1]/div[1]/ul/li[4]')
Report.click()

# 进入新页面
for handle in wd.window_handles:
    wd.switch_to.window(handle)
    if '登录' in wd.title:
        break


# 输入用户名和密码
name = wd.find_element(By.XPATH, '//*[@id="username"]')
name.send_keys('')
password = wd.find_element(By.XPATH, '//*[@id="password"]')
password.send_keys('')
login = wd.find_element(By.XPATH, '//*[@id="fm1"]/div[4]/div/input[6]')
login.click()

# 新建
New_r = wd.find_element(By.ID, 'dw_nBtn')
New_r.click()

# 进入每日一报界面
wd.switch_to.frame('side_dw_m_page_frame')

# 选择地区
S1 = wd.find_element(By.XPATH, '//*[@id="selCity_SF"]')
S1.click()
S2 = wd.find_element(By.XPATH, '//*[@id="selCity_SF"]/option[2]')
S2.click()
S3 = wd.find_element(By.ID, 'selArea_SF')
S3.click()
S4 = wd.find_element(By.XPATH, '//*[@id="selArea_SF"]/option[12]')
S4.click()

# 选择体温 正常
hour = int(time.strftime('%H'))
if 0 <= hour < 12:
    span = wd.find_element(By.ID, 'select2-SWTW-container')
    span.click()

    select = Select(wd.find_element(By.ID, 'SWTW'))
    select.select_by_value('0')
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值