zoukankan      html  css  js  c++  java
  • IT桔子网模拟登陆,selenium定位type属性

    selenium定位type属性

    driver.find_element_by_css_selector('input[type="password"]').send_keys('Password')

    from selenium import webdriver	#用来驱动浏览器的
    from selenium.webdriver import ActionChains	#破解滑动验证码的时候用,可拖动图片
    from selenium.webdriver.common.by import By #按照什么方式查找,By.ID,By.CSS_SELECTOR
    from selenium.webdriver.common.keys import Keys	#键盘按键操作
    from selenium.webdriver.support import expected_conditions as EC		# 和下面WebDriverWait一起用的
    from selenium.webdriver.support.wait import WebDriverWait	#等待页面加载某些元素
    
    driver = webdriver.Chrome()
    driver.get('https://www.itjuzi.com/login?url=%2F')
    
    # 方式一 Xpath
    # driver.find_element_by_xpath('//*[@id="app"]/div[1]/div[2]/div/div/div/div/div[2]/div[1]/form/div[1]/div/div[1]/input').send_keys("jeremy.li@mioying.com")
    # driver.find_element_by_xpath('//*[@id="app"]/div[1]/div[2]/div/div/div/div/div[2]/div[1]/form/div[2]/div/div/input').send_keys('Password')
    # driver.find_element_by_xpath('//*[@id="app"]/div[1]/div[2]/div/div/div/div/div[2]/div[1]/div/button').click()
    
    # driver.find_element_by_xpath('//form[@class="el-form"]/div/div/div/input').send_keys('jeremy.li@mioying.com')
    # driver.find_element_by_xpath('//form[@class="el-form"]/div[2]/div/div/input').send_keys('Password')
    
    # 方式二
    driver.find_element_by_css_selector('.el-input__inner').send_keys('jeremy.li@mioying.com')
    driver.find_element_by_css_selector('input[type="password"]').send_keys('Password')
    
  • 相关阅读:
    关于jabber协议
    xmpp相关链接,
    Implementation of the Server Dialback method as defined by the RFC3920
    好吧,隐藏的文件,
    Vue之methods watch和compute的区别和联系
    面向过程编程&面向对象编程
    JS高阶---线程与事件机制(小结)
    Vuex简介
    Vuex操作步骤
    vue单页面应用刷新网页后vuex的state数据丢失的解决方案
  • 原文地址:https://www.cnblogs.com/kai-/p/13191377.html
Copyright © 2011-2022 走看看