我试图通过Python使用Selenium进入web.whatsapp.com,它打开Chrome web浏览器,但不进入网站,但显示"数据。空白页
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:liranewLibMain.py", line 12, in <module>
driver.get("'https://ynet.co.il")
File "D:liranewlibsite-packagesseleniumwebdriverremotewebdriver.py", line 455, in get
self.execute(Command.GET, {"url": url})
File "D:liranewlibsite-packagesseleniumwebdriverremotewebdriver.py", line 444, in execute
self.error_handler.check_response(response)
File "D:liranewlibsite-packagesseleniumwebdriverremoteerrorhandler.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]
您必须将'
移到'https://ynet.co.il
前面。应该是https://ynet.co.il
,即
driver.get("https://ynet.co.il")
那么简单