以下语句不适用于多处理队列,并出现此错误:“ AttributeError:'AutoProxy [Queue]'对象没有属性'queue'”
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
options = Options()
options.add_argument("start-maximized")
options.add_argument('disable-infobars')
options.add_argument("--disable-extensions")
driver = webdriver.Chrome(chrome_options=options, executable_path=r'C:\Utility\BrowserDrivers\chromedriver.exe')
driver.get("https://www.amazon.com/s/ref=nb_sb_noss_1?url=search-alias%3Daps&field-keywords=sonicare+toothbrush")
while True:
try:
current_page_number_element = WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.CSS_SELECTOR, "span.pagnCur")))
driver.execute_script("arguments[0].scrollIntoView(true);", current_page_number_element)
current_page_number = current_page_number_element.get_attribute("innerHTML")
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "span.pagnNextArrow"))).click()
print("page # {} : going to next page".format(current_page_number))
except:
print("page # {} : error, no more pages".format(current_page_number))
break
driver.quit()