from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
from time import sleep
browser = webdriver.Chrome(r"I:\Anaconda\Scripts\chromedriver")
browser.get("http://vip.biancheng.net/")
try:
wait = WebDriverWait(browser, 10)
wait.until(EC.element_to_be_clickable((By.ID, "user-info")))
login_url = browser.find_element_by_link_text("登录")
login_url.click()
input_username = wait.until(EC.element_to_be_clickable((By.ID, "username")))
input_password = wait.until(EC.element_to_be_clickable((By.ID, "password")))
input_username.send_keys("***")
input_password.send_keys("*******")
button_login = browser.find_element(By.ID, "submit")
button_login.click()
index_url = browser.find_element_by_link_text("C语言")
index_url.click()
sleep(10)
except NoSuchElementException:
print("No such element!")
finally:
browser.quit()

selenium-登录C语言中文网的更多相关文章

  1. chrome访问不了go语言中文网

    最近开发转用golang语言,所以经常在晚上搜资料,结果发现go语言中文网,我居然访问不了,刚开始以为是跟go有关,所以被防火长城屏蔽了,结果,偶尔讨论发现办公室的其他两个同事都可以访问,真是奇了怪了 ...

  2. Go1.13 标准库的 http 包爆出重大 bug,你的项目中招了吗? 原创: 王亚楼 Go语言中文网 今天

    Go1.13 标准库的 http 包爆出重大 bug,你的项目中招了吗? 原创: 王亚楼 Go语言中文网 今天

  3. 用python+selenium登录cnblog后新增文章后再次删除该文章

    目的:登录cnblog后新增文章后再次删除该文章并验证 代码如下: #coding: utf-8 from selenium import webdriver from time import sle ...

  4. python3 selenium 登录操作

    使用场景: 测试过程中,有的时候需要登录才可以进行其他操作 举例说明: # coding=utf-8 """ :author: 花花测试 :time: 2017.05.0 ...

  5. selenium登录163邮箱

    环境:windows8  python2.7+selenium+chrome 直接上脚本: # coding=utf-8from selenium import webdriverimport tim ...

  6. 通过selenium登录网页获取特定信息

    前言 最近有需求要登录网站查询一些信息,然后再修改一些信息,而且这种工作重复性很强,想着通过自动化的方式来做这个东西. 技术选择 自动化的方式开始考虑的是用python的爬虫来做,但是登录的网站有好多 ...

  7. selenium登录界面,创建表单并填写提交

    #! python3 # -*- coding:utf8 -*- # https://selenium-python.readthedocs.io/api.html#selenium.webdrive ...

  8. 使用Selenium登录新浪微博

    为了总结一下Selenium的用法,具体用了这个例子来说明一下. Selenium简单来说,就是通过程序驱动一个浏览器,并且可以通过程序来帮你做一些事情,例如点击.填表呀之类的. 换句话说,你在浏览器 ...

  9. selenium登录 京东滑动验证码

    京东的滑动验证码在页面上是没有原图的,所有我是用ps把他们拼成一个的. from selenium import webdriver from selenium.webdriver import Ac ...

随机推荐

  1. linuxGame:文明5汉化

    此包来源苹果戏台的steam平台 参考网页: 1.https://tieba.baidu.com/p/4529797745 2.http://www.civclub.net/bbs/forum.php ...

  2. [UI] 精美UI界面欣赏[8]

    精美UI界面欣赏[8]

  3. [翻译] DoImagePickerController

    DoImagePickerController An image picker controller with single selection and multiple selection. Sup ...

  4. 转载、Python的编码处理(二)

    以下转自于:wklken的博客,写的非常好的一段有关编码的总结. Python-进阶-编码处理小结 整理下python编码相关的内容 注意: 以下讨论为Python2.x版本, Py3k的待尝试 开始 ...

  5. Python学习---爬虫学习[requests模块]180411

    模块安装 安装requests模块 pip3 install requests 安装beautifulsoup4模块 [更多参考]https://blog.csdn.net/sunhuaqiang1/ ...

  6. php 代码编写规范

    1 编写目的为了更好的提高技术部的工作效率,保证开发的有效性和合理性,并可最大程度的提高程序代码的可读性和可重复利用性,指定此规范.开发团队根据自己的实际情况,可以对本规范进行补充或裁减. 2 整体要 ...

  7. java 和 javascript CryptoJS 进行HmacSHA1加密

    import java.io.IOException; import java.io.UnsupportedEncodingException; import java.security.Invali ...

  8. 企业大数据之Elasticsearch的搜索类型

    下面的 ES基于版本(V2.3.4) ES之默认 1.默认自动发先同一局域网的所有集群节点 2.默认一个索引库会有5个分片,(分片越多,效率越好) 由于这两个默认,所以统一索引库的分片对分布在不同机器 ...

  9. 如何运行vue项目(从gethub上download的开源项目)

    前提:入坑vue.js,从GitHub上download一个vue.js的开源项目,发现不知如何在浏览器运行,通过查阅网上教程,发现网上的很多是教你怎么新建项目,并没有一个是教如何打开已有的项目.自已 ...

  10. arcgis 10.1 导入数据到oracle 发布地图服务

    机器配置说明 数据库服务器 系统:linux 软件:oracle 11G 64位 Arcgis server服务器 系统:win7 专业版 软件:arcgis server 10.1.win64_11 ...