标签:组成 mozilla tee app orm submit htm str code
await page.setUserAgent( ‘Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299‘) # 设置ua await page.goto("https://passport.alibaba.com/icbu_login.htm?/") # 请求网站
await page.type("#fm-login-id", name, {‘delay‘: random.randint(100, 151) - 50}) # 输入框 #代表id ‘.‘代表class 第二个参数是输入值
await page.xpath(‘//*[@id="fm-login-submit"]‘) # xpath使用
page.xpath(‘//*[@id="login-error"]/span[2]/text()‘)
await page.content() # 页面源码
await page.cookies() # cookies
cookies_list = await page.cookies()
for cookie in cookies_list:
str_cookie = ‘{0}={1};‘
str_cookie = str_cookie.format(cookie.get(‘name‘), cookie.get(‘value‘))
cookies += str_cookie # 组成cookies字符串
标签:组成 mozilla tee app orm submit htm str code
原文地址:https://www.cnblogs.com/itBlogToYpl/p/13153762.html