简体   繁体   English

运行程序时无法在 chrome 上显示网站

[英]Unable to display website on chrome when ran the program

I had recently started learning automation with python using selenium.我最近开始使用 selenium 使用 python 学习自动化。 I had installed chromedriver but when i run the code chrome displays no output.我已经安装了 chromedriver,但是当我运行代码时,chrome 显示没有 output。 My code:我的代码:

from selenium import webdriver
PATH = "C:\Program Files (x86)\chromedriver.exe"
driver = webdriver.Chrome(PATH)
driver.get("www.wikipedia.com")

Output Output

Output: Output:

C:\Users\Admin\PycharmProjects\untitled\venv\Scripts\python.exe C:/Users/Admin/PycharmProjects/untitled/1.py
Traceback (most recent call last):
  File "C:/Users/Admin/PycharmProjects/untitled/1.py", line 5, in <module>
    driver.get("www.wikipedia.com")
  File "C:\Users\Admin\PycharmProjects\untitled\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 333, in get
    self.execute(Command.GET, {'url': url})
  File "C:\Users\Admin\PycharmProjects\untitled\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "C:\Users\Admin\PycharmProjects\untitled\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: invalid argument
  (Session info: chrome=88.0.4324.96)

Please help as I'm unable to proceed.请帮忙,因为我无法继续。 Thanks!谢谢!

URL should contain scheme . URL 应该包含scheme Simply replace只需更换

"www.wikipedia.com"

with

"https://www.wikipedia.com"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 程序在运行时立即关闭 - Program immediately closes when ran 运行时 Python 中的程序错误(Python 2.7) - Program Error in Python When Ran (Python 2.7) 从IDLE运行时,同一个程序运行良好,但直接运行时,同一个程序运行不正常 - Same Program Runs Fine when ran from IDLE but not when ran directly Python Selenium - 网站在无头运行时表现不同 - Python Selenium - Website Behaves Differently When Ran Headless 从另一个模块运行时,Python BackgroundScheduler程序崩溃 - Python BackgroundScheduler program crashing when ran from another module 在独立群集上运行时,Spark程序会产生奇怪的结果 - Spark program gives odd results when ran on standalone cluster 运行时,程序会在末尾添加一大段突出显示的文本? - When ran, the program adds a large section of highlighted text at the end? 从运行导入程序的按钮运行程序时弹出空白“tk”window | 适用于 Tkinter - Blank 'tk' window popping up when program is ran from a button which runs an imported program | For Tkinter 获取程序运行的时间(Python) - Get time that program ran (Python) TemplateNotFound:将网站部署在Google App Engine上但在本地主机中运行时网站运行正常时,templates / HomePage.html错误 - TemplateNotFound: templates/HomePage.html error when website is deployed on Google app engine but the website run fine when ran in local host
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM