Invalid argument

The invalid argument error is a WebDriver error that occurs when the arguments passed to a command are either invalid or malformed.

Invalid argument errors can be likened to TypeErrors in JavaScript, in that they can occur for a great many APIs when the input value is not of the expected type or malformed in some way. See the type- and bounds constraints for each WebDriver command.

Example

It is for example not possible to set a window size to a negative value:

python
from selenium import webdriver
from selenium.common import exceptions

session = webdriver.Firefox()
try:
    session.set_window_size(-100, 0)
except exceptions.InvalidArgumentException as e:
    print(e.message)

Output:

InvalidArgumentException: Expected -100 to be >= 0

See also