Python - ExceptionalInputRequirement

I'm diving into the world of web scraping, but I keep running into roadblocks whenever I attempt to access a URL.

Here's the code I'm working with:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys


driver = webdriver.Chrome()
driver.get('www.python.org')

While this successfully opens a new Chrome window, it doesn't go any further than that.

The error message that pops up reads as follows:

InvalidArgumentException: invalid argument
  (Session info: chrome=80.0.3987.149)

I primarily use Spyder, which is part of Anaconda, and I have my chromedriver.exe set up in both the Anaconda3 folder and the Spyder folder.

Any help or advice would be greatly appreciated!

Answer №1

The provided link is invalid as it must be prefixed with http://

import selenium
from selenium.webdriver.common.keys import Keys

try:
  driver = webdriver.Chrome()
  driver.get('http://www.python.org')
except Exception as e:
  print(e)
finally:
  if driver is not None:
    driver.close()

Answer №2

For optimal results, make sure to include the executable path and try out the solution provided below:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver = webdriver.Chrome(executable_path=r"C:\Users\User\chromedriver.exe")

driver.get("https://www.python.org")

It seems there was a mistake in the URL you provided as www.python.org, please use the correct URL: https://www.python.org

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The error message "Unsupported browser: chromedriver.exe" is thrown by SeleniumLibrary in Robot Framework

I encountered an issue while automating a login scenario using Robot framework with Python. The first test case in the suite failed due to lack of support for chrome/gecko driver. We have completed all installations and set the webdriver paths for geckodr ...

Python code: Attempting to retrieve the hour, minute, and second values from a datetime object

As a newcomer to the Python environment, I am working on manipulating datetime objects by using the method replace(hour=...,minute=...,second=...) in an iterative manner and storing the results at each step in a pd.Series. The objective is to have a pd.Ser ...

Guide on navigating to a different TAB using selenium webdriver and python

import unittest from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.common.by import B ...

NumericError on /post_create/ unrecognizable numeric value: 'manish'

I have a unique vision: I want to create posts with different authors in separate models def post_creation(request): author, initiated = Author.objects.get_or_create(name=request.user.username) form = CreationForm(request.POST or None , request.FILES or ...

Accelerate parameter experimentation by leveraging Dask

In my time series dataframe, I have around 10 columns where I am manipulating the data to generate strategy results. Recently, I decided to test out two parameters to see if they have any influence on each other. However, when I tested them individually, e ...

Unable to run if-else statement code while verifying the enabled status of a button

I've been attempting to verify the functionality of the button on indeed.com that appears after clicking "apply job," but my code isn't producing the desired outcome. The initial if statement checks if the continue button is enabled; if not, it w ...

Unable to get Click() method to function properly with C# in Selenium IDE

I am attempting to run a Selenium test using C#. The test has been recorded on the Selenium IDE and has been verified to work with the IDE tool. It is a simple demonstration. The steps involve navigating to the United Airlines website, entering flight info ...

kombu.exceptions.SerializeError: Unable to serialize user data in JSON format

I am currently working with a Django 1.11.5 application and Celery 4.1.0, but I keep encountering the following error: kombu.exceptions.EncodeError: <User: testuser> is not JSON serializable Here are my settings in settings.py: CELERY_BROKER_URL = ...

Converting UTF-8 values to strings using Python 3

Hello, I am currently using Python3 and I need to convert a utf8 value to a string by decoding it. Here is the code snippet I have so far: s1 = '\u54c7' print(chr(ord(s1))) # print 哇 It works fine when the input is just one character, ...

Are mistake entries in a DataFrame using .loc in Pandas a bug or a misunderstanding?

Is there a way to update the contents of an excel file using values from a Python dictionary? I've been trying to use the .loc function, but it seems to be working inconsistently. Sometimes it writes the correct values, and other times it writes the c ...

Python 2: Exploring the differences between a Unicode object and a string object

I came across this issue on StackOverflow, but I was unable to find a satisfactory solution: The problem I am facing involves comparing Unicode strings received from a server with hardcoded strings in my code. Even though I understand why a simple == comp ...

Facing difficulty transferring an array from React to Django

Trying to transfer an array from the React frontend (stored in local storage) to my view class in Django is resulting in the following error: Console Output: GET http://127.0.0.1:8000/api/quiz/multiple/ 500 (Internal Server Error) Django Logs: for qu ...

Managing imported text in Python: techniques and methods

My text file has the following format: 1, blabal.1 2, bal,abla2 3, bal,a.bla3 I am looking to extract the numbers and texts into separate variables. How can I achieve this? number_list = [1, 2, 3] texts = ["balabal1", "balabal2", "balabal3"] ...

Using Selenium and Python to find an element with the "if not" statement before calling navigator.find_element

Good evening everyone, I am currently working on extracting data from a specific website: The program follows a loop-based logic. Upon opening the website page, the first step is to access the calendar and check for any matches played in the current mon ...

Encountered an error in Pytorch LSTM conversion to ONNX.js: "Uncaught (in promise) Error: LSTM_4 node does not recognize input ''

I am attempting to execute a Pytorch LSTM network in the browser, but I am encountering the following error: graph.ts:313 Uncaught (in promise) Error: unrecognized input '' for node: LSTM_4 at t.buildGraph (graph.ts:313) at new t (graph.t ...

Obtain the name of the month from the given date input

Hey there! I've been working on a function that allows users to input their birthdate and receive relevant information, like the month name corresponding to the date they entered. However, I'm currently only getting the month number instead of th ...

Get the item from the dictionary so that it can be effortlessly converted through json.dumps()

Is there a more Pythonic way to achieve the desired output below rather than manually crafting it? I was considering using a dictionary for this, but given my limited knowledge of Python, I believe there may be a simpler approach. My ultimate goal is to ge ...

Unable to store form information in Django's database

I'm currently working on form creation for my Django project and I've encountered an issue. I am unable to save form data to the Django database specifically for one of my forms. While I can successfully add data for the Wish_list model, I'm ...

How can I ensure that the results retrieved from the Pocket API JSON are always in a single row? Let's find a solution

I have been attempting for hours and conducting a thorough search to extract a dataframe from the list retrieved from my Pocket API. However, my code is aggregating everything into a single row, which is not the desired outcome. I have made numerous atte ...

Tips for saving comma-separated values to one CSV document:

Is there a way to create a CSV file with a single column, where each row consists of values separated by either ',' or ';'? Here is an example: the data [['s', [1, 2, 3]], ['a', [4, 5, 6]]] I want the CSV to look l ...