第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

Selenium 鼠標(biāo)滾輪下拉加載所有頁(yè)面

Selenium 鼠標(biāo)滾輪下拉加載所有頁(yè)面

躍然一笑 2022-06-02 14:38:04
模擬鼠標(biāo)滾輪加載所有元素。我搜索了谷歌并嘗試了很多但失敗了。from selenium import webdriverfrom selenium.webdriver.common.keys import Keysimport time# Configuration informationemail = "*******"password = "*******"driver = webdriver.Chrome()index_url = "https://quip.com/"driver.get(url=index_url)driver.find_element_by_xpath('//*[@id="header-nav-collapse"]/ul/li[9]/a').click()  # click logintime.sleep(1)driver.find_element_by_xpath('/html/body/div[2]/div[1]/div[1]/form/div/input').send_keys(email)  # input emaildriver.find_element_by_xpath('//*[@id="email-submit"]').click()time.sleep(1)driver.find_element_by_xpath('/html/body/div/div/form/div/input[2]').send_keys(password)  # input passworddriver.find_element_by_xpath('/html/body/div/div/form/button').click()time.sleep(2)下拉滾動(dòng)js="var q=document.documentElement.scrollTop=100000" driver.execute_script(js)time.sleep(3)driver.maximize_window()driver.find_element_by_xpath("xpath").send_keys(Keys.DOWN)js="var q=document.documentElement.scrollTop=10000"driver.execute_script(js)上述方法不起作用。
查看完整描述

1 回答

?
函數(shù)式編程

TA貢獻(xiàn)1807條經(jīng)驗(yàn) 獲得超9個(gè)贊

要向下滾動(dòng)網(wǎng)頁(yè)https://testselenium.quip.com/直到最后一個(gè)條目,您必須誘導(dǎo)WebDriverWait并且visibility_of_element_located()您可以使用以下Locator Strategies:


代碼塊:


from selenium import webdriver

from selenium.webdriver.common.by import By

from selenium.webdriver.support.ui import WebDriverWait

from selenium.webdriver.support import expected_conditions as EC


chrome_options = webdriver.ChromeOptions()

chrome_options.add_argument("start-maximized")

#chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"])

#chrome_options.add_experimental_option('useAutomationExtension', False)

driver = webdriver.Chrome(options=chrome_options, executable_path=r'C:\Utility\BrowserDrivers\chromedriver.exe')

driver.get("https://quip.com/")

WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "a.btn-sm[href='/account/login']"))).click()

WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "input[name='email']"))).send_keys("187069474@qq.com")

driver.find_element_by_css_selector("button#email-submit").click()

WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "input[name='password']"))).send_keys("Huangbo1019@")

driver.find_element_by_css_selector("button.submit").click()

driver.execute_script("arguments[0].scrollIntoView(true);", WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.CSS_SELECTOR, "div.nav-inbox-import-title"))))

瀏覽器快照:

http://img1.sycdn.imooc.com//62985af70001b07b06580368.jpg

查看完整回答
反對(duì) 回復(fù) 2022-06-02
  • 1 回答
  • 0 關(guān)注
  • 411 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)