importtimeimportrandomfrom selenium importwebdriverdefautoSelect():#将问卷星网站放在下面

driver.get('https://www.wenjuan.com/s/IFNFni')

key_1= str(random.randint(1, 4))

list1= ['计算机', '会计', '汽修', '幼师', '建筑', '工商']

key_2= list1[random.randint(0,5)]#单选题,因为和后面的题有逻辑关系,记下随机值key_1

xpath1 = '//*[@id="question_5e647ab73631f215eee34177"]/div[2]/div[3]/div[1]/div[%s]/label[1]' %key_1

answer_1=driver.find_elements_by_xpath(xpath1)[0]

answer_1.click()#2

for i in range(random.randint(2, 5)):

xpath2= '//*[@id="question_5e647ab73631f215eee34178"]/div[2]/div[3]/div[1]/div[%s]/label[1]' % random.randint(1, 6)

answer_2=driver.find_elements_by_xpath(xpath2)[0]

answer_2.click()#3

xpath3 = '//*[@id="question_5e647ab73631f215eee34179"]/div[2]/div[3]/div[1]/div[%s]/label[1]' % random.randint(1, 5)

answer_3=driver.find_elements_by_xpath(xpath3)[0]

answer_3.click()#4

xpath4 = '//*[@id="question_5e647ab73631f215eee3417a"]/div[2]/div[3]/div[1]/div[%s]/label[1]' % random.randint(1, 5)

answer_4=driver.find_elements_by_xpath(xpath4)[0]

answer_4.click()#5

xpath5 = '//*[@id="question_5e647ab73631f215eee3417b"]/div[2]/div[3]/div[1]/div[%s]/label[1]' % random.randint(1, 5)

answer_5=driver.find_elements_by_xpath(xpath5)[0]

answer_5.click()#6

xpath5 = '//*[@id="question_5e647ab73631f215eee3417c"]/div[2]/div[3]/div[1]/div[%s]/label[1]' % random.randint(1, 4)

answer_5=driver.find_elements_by_xpath(xpath5)[0]

answer_5.click()#7

xpath5 = '//*[@id="question_5e647ab73631f215eee3417d"]/div[2]/div[3]/div[1]/div[%s]/label[1]' % random.randint(1, 6)

answer_5=driver.find_elements_by_xpath(xpath5)[0]

answer_5.click()#8

xpath5 = '//*[@id="question_5e647ab73631f215eee3417e"]/div[2]/div[3]/div[1]/div[%s]/label[1]' % random.randint(1, 4)

answer_5=driver.find_elements_by_xpath(xpath5)[0]

answer_5.click()#9

xpath5 = '//*[@id="question_5e647ab73631f215eee3417f"]/div[2]/div[3]/div[1]/div[%s]/label[1]' % random.randint(1, 4)

answer_5=driver.find_elements_by_xpath(xpath5)[0]

answer_5.click()#10

xpath5 = '//*[@id="question_5e647ab73631f215eee34180"]/div[2]/div[3]/div[1]/div[%s]/label[1]' % random.randint(1, 4)

answer_5=driver.find_elements_by_xpath(xpath5)[0]

answer_5.click()#11

xpath5 = '//*[@id="question_5e647ab73631f215eee34181"]/div[2]/div[3]/div[1]/div[%s]/label[1]' % random.randint(1, 5)

answer_5=driver.find_elements_by_xpath(xpath5)[0]

answer_5.click()#12

xpath5 = '//*[@id="question_5e647ab73631f215eee34182"]/div[2]/div[3]/div[1]/div[%s]/label[1]' % random.randint(1, 4)

answer_5=driver.find_elements_by_xpath(xpath5)[0]

answer_5.click()#13

for i in range(1,4):

xpath5= '//*[@id="question_5e647ab73631f215eee34183"]/div[2]/div[3]/div[1]/div[%s]/label[1]' % random.randint(1, 5)

answer_5=driver.find_elements_by_xpath(xpath5)[0]

answer_5.click()#14

xpath5 = '//*[@id="question_5e647ab73631f215eee34184"]/div[2]/div[3]/div[1]/div[%s]/label[1]' % random.randint(1, 3)

answer_5=driver.find_elements_by_xpath(xpath5)[0]

answer_5.click()#15

for i in range(2, 4):

xpath5= '//*[@id="question_5e647ab73631f215eee34185"]/div[2]/div[3]/div[1]/div[%s]/label[1]' % random.randint(1, 4)

answer_5=driver.find_elements_by_xpath(xpath5)[0]

answer_5.click()#16

driver.find_element_by_id("5e647ab73631f215eee341d0").send_keys(key_2)#17

xpath5 = '//*[@id="question_5e647ab73631f215eee34187"]/div[2]/div[3]/div[1]/div[%s]/label[1]' % random.randint(1, 4)

answer_5=driver.find_elements_by_xpath(xpath5)[0]

answer_5.click()#18

xpath5 = '//*[@id="question_5e647ab73631f215eee34188"]/div[2]/div[3]/div[1]/div[%s]/label[1]' % random.randint(1, 5)

answer_5=driver.find_elements_by_xpath(xpath5)[0]

answer_5.click()#19

xpath5 = '//*[@id="question_5e647ab73631f215eee34189"]/div[2]/div[3]/div[1]/div[%s]/label[1]' % random.randint(1, 2)

answer_5=driver.find_elements_by_xpath(xpath5)[0]

answer_5.click()#20

for i in range(0, 5):

xpath5= '//*[@id="question_5e647ab73631f215eee3418a"]/div[2]/div[3]/div[1]/div[%s]/label[1]' % random.randint(1, 6)

answer_5=driver.find_elements_by_xpath(xpath5)[0]

answer_5.click()#21

xpath5 = '//*[@id="question_5e647ab73631f215eee3418b"]/div[2]/div[3]/div[1]/div[%s]/label[1]' % random.randint(1, 3)

answer_5=driver.find_elements_by_xpath(xpath5)[0]

answer_5.click()#提交

submit = driver.find_elements_by_id('next_button')[0]

submit.click()

time.sleep(1)

driver.quit()if __name__ == '__main__':#循环4次

for index in range(1, 5):

driver=webdriver.Chrome()

autoSelect()

python问卷星微信登录_Python+Selenium自动刷问卷星问卷相关推荐

  1. python爬取qq邮箱_python+selenium自动登录QQ邮箱

    环境:win10x64+python3.5+chrome+chromedriver 需要安装的模块: 1.chromedriver 下载地址,下载后加入系统环境变量即可. 2.selenium# pi ...

  2. python模拟qq空间登录_python selenium模拟登录163邮箱和QQ空间

    最近在看python网络爬虫,于是我想自己写一个邮箱和QQ空间的自动登录的小程序, 下面以登录163邮箱和QQ空间和为例: 了解到在Web应用中经常会遇到frame/iframe 表单嵌套页面的应用, ...

  3. 在哪里能收到python实例代码-python实现网站微信登录的示例代码

    最近微信登录开放公测,为了方便微信用户使用,我们的产品也决定加上微信登录功能,然后就有了这篇笔记. 根据需求选择相应的登录方式 python实现网站微信登录的示例代码 微信现在提供两种登录接入方式 移 ...

  4. python通过cookie绕过验证码_Python Selenium Cookie 绕过验证码实现登录示例代码

    之前介绍过通过cookie 绕过验证码实现登录的方法.这里并不多余,会增加分析和另外一种方法实现登录. 1.思路介绍 1.1.直接看代码,内有详细注释说明 # FileName : Wm_Cookie ...

  5. python自动评论_Python+selenium自动评价器

    Python+selenium自动评价器 年年岁岁又一年,为了纪念一哈2020年的最后一天,我决定写下这篇文章.你问我为什么要纪念?因为那天我女朋友加班了...,具体什么任务呢?就是一个指标任务,需要 ...

  6. python 用题库自动答题器_python实现自动刷题

    使用Python实现云豆网自动刷题 这些是一大佬写的我就解读一下 所有代码全是Py3 要有一些Python基础emmm不用太多 不懂就问我的QQ:2025450852 大体思路: 控制浏览器模拟点击 ...

  7. python实现网页微信登录_网站微信登录-python 实现

    最近微信登录开放公测,为了方便微信用户使用,我们的产品也决定加上微信登录功能,然后就有了这篇笔记. 根据需求选择相应的登录方式 微信现在提供两种登录接入方式 移动应用微信登录 网站应用微信登录 这里我 ...

  8. python中实现微信登录

    微信登录流程图: 视频效果: flask项目实现微信登录 1. view代码 from flask import Flask, render_template from flask import Ma ...

  9. python批量删除微信好友_Python找出微信上删除你好友的人脚本写法

    原标题:Python找出微信上删除你好友的人脚本写法 相信大家在微信上一定被上面的这段话刷过屏,群发消息应该算是微信上流传最广的找到删除好友的方法了.但群发消息不仅仅会把通讯录里面所有的好友骚扰一遍, ...

  10. python自动登录百度帐号_python selenium自动登录百度加转窗口

    大概思路: 1.定位到登录界面的名字,密码输入框 2.获取当前窗口句柄 3.打印网页title证明句柄以及装换 from selenium import webdriver import time d ...

最新文章

  1. kettle组件-输出
  2. web.py搭建服务器
  3. php excel parser pro v4.2,php中使用ExcelFileParser处理excel获得数据(可作批量导入到数据库使用)...
  4. Openstack_单元测试
  5. linux指向域同步时间,linux在局域网下设置时间同步
  6. [渝粤教育] 中国地质大学 信息管理概论 复习题
  7. [html] 渐进式渲染是什么?
  8. C++基础学习(02)--(数据类型,变量类型,变量作用域,常量,修饰符类型)
  9. Session丢失的解决办法小结(转)
  10. sqlserver查询包含在一个字段里面的某一个元素
  11. paip.php调试imcompatible debug sever version..with zend debugger
  12. MySQL复制之gtid_purged与gtid_executed
  13. HTML数据可视化散点图,数据可视化:用散点图进行数据分析
  14. 谷歌中国团队遭哄抢 部分员工私下接洽新公司
  15. 2017计算机知识竞赛题,2017年《西游记》知识竞赛试题100题附答案.doc
  16. android 卫星地图,推荐一款亲测好用,可显示卫星地图,高斯平面直角坐标和计算图幅编号等功能的安卓定位导航软件~...
  17. 多邻国学英语 tips
  18. 巴拿赫空间的基本性质
  19. PD的CDM模型中的三种实体关系
  20. 服务器硬盘做过raid5如何设置初始化,服务器做了raid 5之后硬盘怎么分区呢?

热门文章

  1. VS生成的C++项目常用目录设置
  2. 小米8装magisk
  3. 小米平板 计算机 连接打印机,小米米家喷墨打印机:打印方式介绍
  4. java font 字体大小_java的字体的颜色,型号,大小的方法
  5. 程序员必须知道的一些事
  6. Vue 移动端 股票 分时 K线
  7. 新传要不要学计算机,传媒计算机实在性:真实性表象和新传媒
  8. .axf文件_「嵌入式笔记」hex文件、bin文件、axf文件的区别?
  9. 【CCF会议期刊推荐】中国计算机协会(CCF)推荐国际学术期刊/会议(软件工程/系统软件/程序设计语言)
  10. 【统计学】利用spss正态分布假定检验 S-W检验 K-S检验 直方图 Q-Q图