Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mohamedkhallouq
GitHub Repository: mohamedkhallouq/content
Path: blob/main/files/en-us/web/webdriver/errors/invalidargument/index.md
6517 views
---
title: Invalid argument slug: Web/WebDriver/Errors/InvalidArgument
---

{{QuickLinksWithSubpages("/en-US/docs/Web/WebDriver/Errors")}}

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:

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