我的代码遇到问题:未检测到的chromedriver自动关闭几秒钟后,我希望你能帮助我∅. this image show the error:
import pandas as pd
import undetected_chromedriver as webdriver
import os
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
import pyautogui
import time
print("ready?")
print("loading.......................................")
df = pd.read_excel("Moaaz.xlsx","Moaaz")
email = "sisoasn81@gmail.com"
password = "1*1#36@$%anz"
name = df["Name"].values.tolist()
website = df["Website"].values.tolist()
phone = df["Phone"].values.tolist()
logo = df["Logo"].values.tolist()
firm_map = df["Firm map"].values.tolist()
if "PROGRAMFILES(X86)" not in os.environ:
os.environ["PROGRAMFILES(X86)"] = ""
if __name__ == "__main__":
driver = webdriver.Chrome(use_subprocess=True)
driver.get('https://www.blogger.com/blog/posts/3793019451239403430')
time.sleep(2)
driver.maximize_window()
time.sleep(2)
driver.find_element_by_id('identifierId').send_keys(email)
time.sleep(3)
driver.find_element_by_id('identifierNext').click()
time.sleep(3)
driver.find_element_by_id('password').send_keys(password)
time.sleep(2)
driver.find_element_by_id('passwordNext').click()
time.sleep(10)
for s in range(len(name)):
#click new post
driver.find_element_by_class_name('U26fgb O0WRkf zZhnYe e3Duub C0oVfc zr7Fj zFM5pd M9Bg4d').click()
#enter name dog
driver.find_element_by_class_name('whsOnd zHQkBf').send_keys(name[s])
#convert to html view
pyautogui.leftClick(627, 707)
pyautogui.leftClick(455, 206)
pyautogui.leftClick(149, 279)
driver.stop_client()
我希望你能帮助我,我试着解决它,但我不能。
1条答案
按热度按时间wlp8pajw1#
你得到了“无法定位元素”的例外。你可以实现等待元素出现,并检查它是否是正确的Element-id(在
driver.find_element_by_id('password').send_keys(password)