selenium 它不会打开Chrome,如果打开了,它会一直刷新,没有任何结果

icnyk63a  于 2022-11-10  发布在  其他
关注(0)|答案(1)|浏览(222)

我试着在通过PYTHON使用Selenson的时候进入网站,它打开了Chrome网页浏览器,但没有进入网站,而是显示了“数据。”空白页面。

import pandas as pd
import webbrowser
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManagerz
options=Options()
options.add_experimental_option("detach",True)
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)

# driver.get("'https://web.whatsapp.com/send?phone='+x+'&text='+message+''")

driver.get("'https://ynet.co.il")

# driver = webdriver.Edge()

import time

我本应在网站页面上打开浏览器,但结果却打开了“data:”空白页面,并出现以下错误:

File "D:\liranew\Lib\Main.py", line 12, in <module>
    driver.get("'https://ynet.co.il")
  File "D:\liranew\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 455, in get
    self.execute(Command.GET, {"url": url})
  File "D:\liranew\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 444, in execute
    self.error_handler.check_response(response)
  File "D:\liranew\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 249, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: invalid argument
  (Session info: chrome=107.0.5304.88)
Stacktrace:
Backtrace:
    Ordinal0 [0x010EACD3+2075859]
    Ordinal0 [0x0107EE61+1633889]
    Ordinal0 [0x00F7B680+571008]
    Ordinal0 [0x00F6E8FE+518398]
    Ordinal0 [0x00F6D2A3+512675]
    Ordinal0 [0x00F6D5AD+513453]
    Ordinal0 [0x00F7D0CE+577742]
    Ordinal0 [0x00FDBC7D+965757]
    Ordinal0 [0x00FC731C+881436]
    Ordinal0 [0x00FDB56A+963946]
    Ordinal0 [0x00FC7136+880950]
    Ordinal0 [0x00F9FEFD+720637]
    Ordinal0 [0x00FA0F3F+724799]
    GetHandleVerifier [0x0139EED2+2769538]
    GetHandleVerifier [0x01390D95+2711877]
    GetHandleVerifier [0x0117A03A+521194]
    GetHandleVerifier [0x01178DA0+516432]
    Ordinal0 [0x0108682C+1665068]
    Ordinal0 [0x0108B128+1683752]
    Ordinal0 [0x0108B215+1683989]
    Ordinal0 [0x01096484+1729668]
    BaseThreadInitThunk [0x74F86359+25]
    RtlGetAppContainerNamedObjectPath [0x773C7C14+228]
    RtlGetAppContainerNamedObjectPath [0x773C7BE4+180]
qlvxas9a

qlvxas9a1#

您必须卸下'https://ynet.co.il前面的'。它应该是https://ynet.co.il,即

driver.get("https://ynet.co.il")

如此简单

相关问题