Chromedriver не отображает данные веб-скрапингаPython

Программы на Python
Anonymous
Chromedriver не отображает данные веб-скрапинга

Сообщение Anonymous »

Я пытаюсь очистить данные веб-сайта с помощью Python.
Я использую Selenium версии 4.20.0
Я не установил chromedriver в свою систему. однако мой скрипт работал нормально, используя только Chrome.
После обновления .91, когда я запускаю скрипт, мой Chrome все еще работает, но просто не отображает никаких данных.
только «данные»; продолжает отображаться на вкладке, а также в поле ввода URL-адреса.
ниже приведен мой код и снимок экрана, на котором данные не отображаются.

Код: Выделить всё

import configparser
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import NoSuchElementException, TimeoutException, StaleElementReferenceException
from openpyxl import load_workbook
import time
import os
import logging

# Get the download path for the current user
config = configparser.ConfigParser()
# Configure logging
logging.basicConfig(filename='app.log', level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')

def run_script(config):

config.read('credentials.ini')
# Load the workbook
book  = config ['Credentials']['saveFilePath']
wb = load_workbook(book)
ws = wb.active
# Clear the sheet
ws.delete_rows(2, ws.max_row)
# Find the next empty row in the worksheet
next_row = ws.max_row + 1

username = config['Credentials']['username']
password = config['Credentials']['password']
AgencyFilePath = config['Credentials']['AgencyFilePath']
workbook = load_workbook(AgencyFilePath)
sheet = workbook.active

try:
driver = webdriver.Chrome()

login_url = 'https://www.google.com'
driver.get(login_url)

wait = WebDriverWait(driver, 30)

username_field = wait.until(
EC.element_to_be_clickable((By.XPATH, '//*[@id="lock-title"]'))
)

# Find the username and password input fields and submit button by class name
username_field = driver.find_element(
By.XPATH, '//*[@id="1-email"]' #xpath of username field
).send_keys(username)

password_field = driver.find_element(
By.XPATH, '//*[@id="1-password"]' #Xpath of password field
).send_keys(password)
изображение проблемы

Подробнее здесь: https://stackoverflow.com/questions/784 ... pping-data

Вернуться в «Python»