selenium.common.exceptions.InvalidArgumentException
Message: invalid argument: ‘using’ must be a string
This exception, selenium.common.exceptions.InvalidArgumentException
, occurs when the “using” argument passed to a Selenium WebDriver method is not a string value.
The “using” argument is used to locate elements on a web page using various locating strategies provided by Selenium.
In order to resolve this exception, make sure the “using” argument is a string value that corresponds to a valid locating strategy.
Example:
Let’s say you have the following code that triggers the exception:
driver.find_element(By.CLASS_NAME, 123)
In this example, the value passed to the “using” argument is an integer (123) instead of a string.
To fix the issue, you need to pass a string value that represents a valid class name:
driver.find_element(By.CLASS_NAME, 'my-class')