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')


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM