How to use InvalidArgumentException class of org.openqa.selenium package

Best Selenium code snippet using org.openqa.selenium.InvalidArgumentException

Run Selenium automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

InvalidArgumentException org.openqa.selenium.InvalidArgumentException

The WebDriver error - invalid argument error, arises when invalid arguments are passed to a command.

The InvalidArgument error is somewhat similar to a TypeError in JavaScript, as both errors can occur for various APIs when the input value is not of the expected type, or is distorted in some way. Look at the type and bounds constraints for every WebDriver command.

Example

For instance, we cannot set the window size to a negative value:

copy
1 2from selenium import webdriver 3 4from selenium.common import exceptions 5 6session = webdriver.Firefox() 7 8try: 9 10session.set_window_size(-100, 0) 11 12except exceptions.InvalidArgumentException as e: 13 14print(e.message) 15

Output:

InvalidArgumentException: Expected -100 to be >= 0

Solutions

  • Check for input values
  • Upgrade the selenium driver versions to avoid compatibility issues with commands

Code Snippets

Here are code snippets that can help you understand more how developers are using

copy
1package practics04.PageObject.utils;
2
3import org.openqa.selenium.InvalidArgumentException;
4import org.openqa.selenium.WebDriver;
5import org.openqa.selenium.chrome.ChromeDriver;
6import org.openqa.selenium.chrome.ChromeOptions;
7import org.openqa.selenium.edge.EdgeDriver;
8import org.openqa.selenium.edge.EdgeOptions;
9import org.openqa.selenium.firefox.FirefoxDriver;
10import org.openqa.selenium.firefox.FirefoxOptions;
11import org.openqa.selenium.ie.InternetExplorerDriver;
12import org.openqa.selenium.ie.InternetExplorerOptions;
13
14public class WebDriverFactory {
15
16    public static WebDriver GetDriver(String browser) {
17        switch (browser.toLowerCase()) {
18            case "chrome":
19                ChromeOptions chromeOptions = new ChromeOptions();
20                chromeOptions.addArguments("--disable-notifications");
21                return new ChromeDriver(chromeOptions);
22            case "firefox":
23                FirefoxOptions ffOptions = new FirefoxOptions();
24                return new FirefoxDriver(ffOptions);
25            case "ie":
26                InternetExplorerOptions ieOptions = new InternetExplorerOptions();
27                return new InternetExplorerDriver(ieOptions);
28            case "edge":
29                EdgeOptions edgeOptions = new EdgeOptions();
30                return new EdgeDriver(edgeOptions);
31            default:
32                throw new InvalidArgumentException("Add valid parameters 'browser'. instead of " + browser );
33        }
34    }
35}
36
Full Screen
copy
1import org.openqa.selenium.InvalidArgumentException;
2import org.openqa.selenium.WebDriver;
3import org.openqa.selenium.chrome.ChromeDriver;
4import org.openqa.selenium.firefox.FirefoxDriver;
5import org.openqa.selenium.ie.InternetExplorerDriver;
6import org.openqa.selenium.ie.InternetExplorerOptions;
7import org.testng.annotations.Test;
8
9public class OpenBrowser {
10
11
12    @Test
13    public void openBrowser() {
14
15        /*
16        Zadaniem jest utworzenie nowej metody getDriver, która w zależności od parametru browser będzie nam uruchamiała konkretną przeglądarkę
17        W przypadku gdy wpiszemy nieprawidłową wartość powinniśmy otrzymać wyjątek InvalidArgumentException o treści: Invalid browser name
18         */
19
20
21        WebDriver driver = getDriver("xxx");
22
23
24    }
25
26
27    public WebDriver getDriver(String browser) {
28        switch (browser) {
29            case "chrome":
30                System.setProperty("webdriver.chrome.driver", "C:\\Users\\Saturn\\Desktop\\szkolenie Ania\\selenium\\src\\main\\resources\\executables\\drivers\\chromedriver.exe");
31                return new ChromeDriver();
32            case "firefox":
33                System.setProperty("webdriver.gecko.driver", "C:\\Users\\Saturn\\Desktop\\szkolenie Ania\\selenium\\src\\main\\resources\\executables\\drivers\\geckodriver.exe");
34                return new FirefoxDriver();
35            case "ie":
36                System.setProperty("webdriver.ie.driver", "C:\\Users\\Saturn\\Desktop\\szkolenie Ania\\selenium\\src\\main\\resources\\executables\\drivers\\IEDriverServer.exe");
37                return new InternetExplorerDriver();
38            default:
39                throw new InvalidArgumentException("Invalid browser name");
40        }
41
42    }
43}
44
Full Screen
copy
1public static String encrypt(final String plainMessage,
2                             final String symKeyHex) {
3    final byte[] symKeyData = Base64.decode(symKeyHex,Base64.DEFAULT);
4
5    final byte[] encodedMessage = plainMessage.getBytes(Charset
6            .forName("UTF-8"));
7    try {
8        final Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
9        final int blockSize = cipher.getBlockSize();
10
11        // create the key
12        final SecretKeySpec symKey = new SecretKeySpec(symKeyData, "AES");
13
14        // generate random IV using block size (possibly create a method for
15        // this)
16        final byte[] ivData = new byte[blockSize];
17        final SecureRandom rnd = SecureRandom.getInstance("SHA1PRNG");
18        rnd.nextBytes(ivData);
19        final IvParameterSpec iv = new IvParameterSpec(ivData);
20
21        cipher.init(Cipher.ENCRYPT_MODE, symKey, iv);
22
23        final byte[] encryptedMessage = cipher.doFinal(encodedMessage);
24
25        // concatenate IV and encrypted message
26        final byte[] ivAndEncryptedMessage = new byte[ivData.length
27                + encryptedMessage.length];
28        System.arraycopy(ivData, 0, ivAndEncryptedMessage, 0, blockSize);
29        System.arraycopy(encryptedMessage, 0, ivAndEncryptedMessage,
30                blockSize, encryptedMessage.length);
31
32        final String ivAndEncryptedMessageBase64 = Base64.encodeToString(ivAndEncryptedMessage,Base64.DEFAULT);
33
34        return ivAndEncryptedMessageBase64;
35    } catch (InvalidKeyException e) {
36        throw new IllegalArgumentException(
37                "key argument does not contain a valid AES key");
38    } catch (GeneralSecurityException e) {
39        throw new IllegalStateException(
40                "Unexpected exception during encryption", e);
41    }
42}
43
44public static String decrypt(final String ivAndEncryptedMessageBase64,
45                             final String symKeyHex) {
46    final byte[] symKeyData = Base64.decode((symKeyHex),Base64.DEFAULT);
47
48    final byte[] ivAndEncryptedMessage = Base64.decode(ivAndEncryptedMessageBase64,Base64.DEFAULT);
49    try {
50        final Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
51        final int blockSize = cipher.getBlockSize();
52
53        // create the key
54        final SecretKeySpec symKey = new SecretKeySpec(symKeyData, "AES");
55
56        // retrieve random IV from start of the received message
57        final byte[] ivData = new byte[blockSize];
58        System.arraycopy(ivAndEncryptedMessage, 0, ivData, 0, blockSize);
59        final IvParameterSpec iv = new IvParameterSpec(ivData);
60
61        // retrieve the encrypted message itself
62        final byte[] encryptedMessage = new byte[ivAndEncryptedMessage.length
63                - blockSize];
64        System.arraycopy(ivAndEncryptedMessage, blockSize,
65                encryptedMessage, 0, encryptedMessage.length);
66
67        cipher.init(Cipher.DECRYPT_MODE, symKey, iv);
68
69        final byte[] encodedMessage = cipher.doFinal(encryptedMessage);
70
71        // concatenate IV and encrypted message
72        final String message = new String(encodedMessage,
73                Charset.forName("UTF-8"));
74
75        return message;
76    } catch (InvalidKeyException e) {
77        throw new IllegalArgumentException(
78                "key argument does not contain a valid AES key");
79    } catch (BadPaddingException e) {
80        // you'd better know about padding oracle attacks
81        return null;
82    } catch (GeneralSecurityException e) {
83        throw new IllegalStateException(
84                "Unexpected exception during decryption", e);
85    }
86}
87
Full Screen
copy
1    public static String encrypt(final String plainMessage,
2            final String symKeyHex) {
3        final byte[] symKeyData = DatatypeConverter.parseHexBinary(symKeyHex);
4
5        final byte[] encodedMessage = plainMessage.getBytes(Charset
6                .forName("UTF-8"));
7        try {
8            final Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
9            final int blockSize = cipher.getBlockSize();
10
11            // create the key
12            final SecretKeySpec symKey = new SecretKeySpec(symKeyData, "AES");
13
14            // generate random IV using block size (possibly create a method for
15            // this)
16            final byte[] ivData = new byte[blockSize];
17            final SecureRandom rnd = SecureRandom.getInstance("SHA1PRNG");
18            rnd.nextBytes(ivData);
19            final IvParameterSpec iv = new IvParameterSpec(ivData);
20
21            cipher.init(Cipher.ENCRYPT_MODE, symKey, iv);
22
23            final byte[] encryptedMessage = cipher.doFinal(encodedMessage);
24
25            // concatenate IV and encrypted message
26            final byte[] ivAndEncryptedMessage = new byte[ivData.length
27                    + encryptedMessage.length];
28            System.arraycopy(ivData, 0, ivAndEncryptedMessage, 0, blockSize);
29            System.arraycopy(encryptedMessage, 0, ivAndEncryptedMessage,
30                    blockSize, encryptedMessage.length);
31
32            final String ivAndEncryptedMessageBase64 = DatatypeConverter
33                    .printBase64Binary(ivAndEncryptedMessage);
34
35            return ivAndEncryptedMessageBase64;
36        } catch (InvalidKeyException e) {
37            throw new IllegalArgumentException(
38                    "key argument does not contain a valid AES key");
39        } catch (GeneralSecurityException e) {
40            throw new IllegalStateException(
41                    "Unexpected exception during encryption", e);
42        }
43    }
44
45    public static String decrypt(final String ivAndEncryptedMessageBase64,
46            final String symKeyHex) {
47        final byte[] symKeyData = DatatypeConverter.parseHexBinary(symKeyHex);
48
49        final byte[] ivAndEncryptedMessage = DatatypeConverter
50                .parseBase64Binary(ivAndEncryptedMessageBase64);
51        try {
52            final Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
53            final int blockSize = cipher.getBlockSize();
54
55            // create the key
56            final SecretKeySpec symKey = new SecretKeySpec(symKeyData, "AES");
57
58            // retrieve random IV from start of the received message
59            final byte[] ivData = new byte[blockSize];
60            System.arraycopy(ivAndEncryptedMessage, 0, ivData, 0, blockSize);
61            final IvParameterSpec iv = new IvParameterSpec(ivData);
62
63            // retrieve the encrypted message itself
64            final byte[] encryptedMessage = new byte[ivAndEncryptedMessage.length
65                    - blockSize];
66            System.arraycopy(ivAndEncryptedMessage, blockSize,
67                    encryptedMessage, 0, encryptedMessage.length);
68
69            cipher.init(Cipher.DECRYPT_MODE, symKey, iv);
70
71            final byte[] encodedMessage = cipher.doFinal(encryptedMessage);
72
73            // concatenate IV and encrypted message
74            final String message = new String(encodedMessage,
75                    Charset.forName("UTF-8"));
76
77            return message;
78        } catch (InvalidKeyException e) {
79            throw new IllegalArgumentException(
80                    "key argument does not contain a valid AES key");
81        } catch (BadPaddingException e) {
82            // you'd better know about padding oracle attacks
83            return null;
84        } catch (GeneralSecurityException e) {
85            throw new IllegalStateException(
86                    "Unexpected exception during decryption", e);
87        }
88    }
89
Full Screen
copy
1    String plain = "Zaphod's just zis guy, ya knöw?";
2    String encrypted = encrypt(plain, "000102030405060708090A0B0C0D0E0F");
3    System.out.println(encrypted);
4    String decrypted = decrypt(encrypted, "000102030405060708090A0B0C0D0E0F");
5    if (decrypted != null && decrypted.equals(plain)) {
6        System.out.println("Hey! " + decrypted);
7    } else {
8        System.out.println("Bummer!");
9    }
10
Full Screen
copy
1@Test
2void exceptionTest() {
3
4   try{
5        model.someMethod("invalidInput");
6        fail("Exception Expected!");
7   }
8   catch(SpecificException e){
9
10        assertTrue(true);
11   }
12   catch(Exception e){
13        fail("wrong exception thrown");
14   }
15
16}
17
Full Screen
copy
1public static void assertThrows(
2public static <T extends Throwable> T expectThrows(
3
Full Screen
copy
1import static org.junit.jupiter.api.Assertions.assertThrows;
2
3@Test
4void exceptionTesting() {
5
6    assertThrows(MyException.class, myStackObject::doStackAction, "custom message if assertion fails..."); 
7
8// note, no parenthesis on doStackAction ex ::pop NOT ::pop()
9}
10
Full Screen
copy
1List<String> emptyList = new ArrayList<>();
2Optional<String> opt2 = emptyList.stream().findFirst();
3assertThrows(NoSuchElementException.class, () -> opt2.get());
4
Full Screen
copy
1assertThrowsExactly(FileNotFoundException.class, () -> service.blah());
2
Full Screen
copy
1Throwable throwable =  assertThrows(Throwable.class, () -> {
2    service.readFile("sampleFile.txt");
3});
4assertEquals(FileNotFoundException.class, throwable.getClass());
5
Full Screen
copy
1import org.junit.jupiter.api.Test;
2
3import static org.junit.jupiter.api.Assertions.assertEquals;
4import static org.junit.jupiter.api.Assertions.assertThrows;
5
6....
7
8@Test
9void exceptionTesting() {
10    Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
11        throw new IllegalArgumentException("a message");
12    });
13    assertEquals("a message", exception.getMessage());
14}
15
Full Screen
copy
1public void validateParameters(Integer param ) {
2    if (param == null) {
3        throw new NullPointerException("Null parameters are not allowed");
4    }
5}
6
Full Screen
copy
1@Test
2@DisplayName("Test assert NullPointerException")
3void testGeneralException(TestInfo testInfo) {
4    final ExpectGeneralException generalEx = new ExpectGeneralException();
5
6     NullPointerException exception = assertThrows(NullPointerException.class, () -> {
7            generalEx.validateParameters(null);
8        });
9    assertEquals("Null parameters are not allowed", exception.getMessage());
10}
11
Full Screen
copy
1public String constructErrorMessage(String... args) throws InvalidParameterCountException {
2    if(args.length!=3) {
3        throw new InvalidParameterCountException("Invalid parametercount: expected=3, passed="+args.length);
4    }else {
5        String message = "";
6        for(String arg: args) {
7            message += arg;
8        }
9        return message;
10    }
11}
12
Full Screen
copy
1@Test
2@DisplayName("Test assert exception")
3void testCustomException(TestInfo testInfo) {
4    final ExpectCustomException expectEx = new ExpectCustomException();
5
6     InvalidParameterCountException exception = assertThrows(InvalidParameterCountException.class, () -> {
7            expectEx.constructErrorMessage("sample ","error");
8        });
9    assertEquals("Invalid parametercount: expected=3, passed=2", exception.getMessage());
10}
11
Full Screen
copy
1@Test
2public void wrongInput() {
3    Throwable exception = assertThrows(InvalidArgumentException.class,
4            ()->{objectName.yourMethod("WRONG");} );
5}
6
Full Screen
copy
1@Test
2public void itShouldThrowNullPointerExceptionWhenBlahBlah() {
3    assertThrows(NullPointerException.class,
4            ()->{
5            //do whatever you want to do here
6            //ex : objectName.thisMethodShoulThrowNullPointerExceptionForNullParameter(null);
7            });
8}
9
Full Screen
copy
1import static org.junit.jupiter.api.Assertions.assertThrows;
2
3@Test
4void exceptionTesting() {
5    MyException thrown = assertThrows(
6           MyException.class,
7           () -> myObject.doThing(),
8           "Expected doThing() to throw, but it didn't"
9    );
10
11    assertTrue(thrown.getMessage().contains("Stuff"));
12}
13
Full Screen
copy
1<?php
2
3class Student {
4    
5    public string $name;
6    public function __construct(string $name){
7        $this->name = $name;
8    }
9    
10}
11
12class Classe {
13    
14    private $students = [];
15    
16    public function add(Student ...$student){
17        array_merge($this->students, $student);
18    }
19    
20    public function getAll(){
21        return $this->students;
22    }
23    
24}
25
26$c = new Classe();
27$c->add(new Student('John'), new Student('Mary'), new Student('Kate'));
28
Full Screen
copy
1/**
2 * Class GenericCollection
3 */
4class GenericCollection implements \IteratorAggregate, \ArrayAccess{
5    /**
6     * @var string
7     */
8    private $type;
9
10    /**
11     * @var array
12     */
13    private $items = [];
14
15    /**
16     * GenericCollection constructor.
17     *
18     * @param string $type
19     */
20    public function __construct(string $type){
21        $this->type = $type;
22    }
23
24    /**
25     * @param $item
26     *
27     * @return bool
28     */
29    protected function checkType($item): bool{
30        $type = $this->getType();
31        return $item instanceof $type;
32    }
33
34    /**
35     * @return string
36     */
37    public function getType(): string{
38        return $this->type;
39    }
40
41    /**
42     * @param string $type
43     *
44     * @return bool
45     */
46    public function isType(string $type): bool{
47        return $this->type === $type;
48    }
49
50    #region IteratorAggregate
51
52    /**
53     * @return \Traversable|$type
54     */
55    public function getIterator(): \Traversable{
56        return new \ArrayIterator($this->items);
57    }
58
59    #endregion
60
61    #region ArrayAccess
62
63    /**
64     * @param mixed $offset
65     *
66     * @return bool
67     */
68    public function offsetExists($offset){
69        return isset($this->items[$offset]);
70    }
71
72    /**
73     * @param mixed $offset
74     *
75     * @return mixed|null
76     */
77    public function offsetGet($offset){
78        return isset($this->items[$offset]) ? $this->items[$offset] : null;
79    }
80
81    /**
82     * @param mixed $offset
83     * @param mixed $item
84     */
85    public function offsetSet($offset, $item){
86        if(!$this->checkType($item)){
87            throw new \InvalidArgumentException('invalid type');
88        }
89        $offset !== null ? $this->items[$offset] = $item : $this->items[] = $item;
90    }
91
92    /**
93     * @param mixed $offset
94     */
95    public function offsetUnset($offset){
96        unset($this->items[$offset]);
97    }
98
99    #endregion
100}
101
102
103/**
104 * Class Item
105 */
106class Item{
107    /**
108     * @var int
109     */
110    public $id = null;
111
112    /**
113     * @var string
114     */
115    public $data = null;
116
117    /**
118     * Item constructor.
119     *
120     * @param int    $id
121     * @param string $data
122     */
123    public function __construct(int $id, string $data){
124        $this->id = $id;
125        $this->data = $data;
126    }
127}
128
129
130/**
131 * Class ItemCollection
132 */
133class ItemCollection extends GenericCollection{
134    /**
135     * ItemCollection constructor.
136     */
137    public function __construct(){
138        parent::__construct(Item::class);
139    }
140
141    /**
142     * @return \Traversable|Item[]
143     */
144    public function getIterator(): \Traversable{
145        return parent::getIterator();
146    }
147}
148
149
150/**
151 * Class ExampleService
152 */
153class ExampleService{
154    /**
155     * @var ItemCollection
156     */
157    private $items = null;
158
159    /**
160     * SomeService constructor.
161     *
162     * @param ItemCollection $items
163     */
164    public function __construct(ItemCollection $items){
165        $this->items = $items;
166    }
167
168    /**
169     * @return void
170     */
171    public function list(){
172        foreach($this->items as $item){
173            echo $item->data;
174        }
175    }
176}
177
178
179/**
180 * Usage
181 */
182$collection = new ItemCollection;
183$collection[] = new Item(1, 'foo');
184$collection[] = new Item(2, 'bar');
185$collection[] = new Item(3, 'foobar');
186
187$collection[] = 42; // InvalidArgumentException: invalid type
188
189$service = new ExampleService($collection);
190$service->list();
191
Full Screen
copy
1class ExampleService{
2    public function __construct(Collection<Item> $items){
3        // ..
4    }
5}
6
Full Screen
copy
1<?php class Collection implements IteratorAggregate{
2      private $type;
3      private $container;
4      public function __construct(array $collection, $type='Object'){
5          $this->type = $type;
6          foreach($collection as $value){
7             if(!($value instanceof $this->type)){
8                 throw new RuntimeException('bad type for your collection');
9             }  
10          }
11          $this->container = new \ArrayObject($collection);
12      }
13      public function getIterator(){
14         return $this->container->getIterator();
15      }
16    }
17
Full Screen
copy
1Class Myclass {
2
3    $objectParent = "MyMainParent"; //Define the interface or abstract class or the main parent class here
4    public function method($classObject) {
5        if(!$classObject instanceof $this -> objectParent) { //check 
6             throw new Exception("Invalid Class Identified");
7        }
8        // Carry on with the function
9    }
10
11}
12
Full Screen
copy
1/**
2 * Generic list logic and an abstract type validator method.
3 */    
4abstract class AbstractList {
5    protected $elements;
6
7    public function __construct() {
8        $this->elements = array();
9    }
10
11    public function add($element) {
12        $this->validateType($element);
13        $this->elements[] = $element;
14    }
15
16    public function get($index) {
17        if ($index >= sizeof($this->elements)) {
18            throw new OutOfBoundsException();
19        }
20        return $this->elements[$index];
21    }
22
23    public function size() {
24        return sizeof($this->elements);
25    }
26
27    public function remove($element) {
28        validateType($element);
29        for ($i = 0; $i < sizeof($this->elements); $i++) {
30            if ($this->elements[$i] == $element) {
31               unset($this->elements[$i]);
32            }
33        }
34    }
35
36    protected abstract function validateType($element);
37}
38
39
40/**
41 * Extends the abstract list with the type-specific validation
42 */
43class MyTypeList extends AbstractList {
44    protected function validateType($element) {
45        if (!($element instanceof MyType)) {
46            throw new InvalidArgumentException("Parameter must be MyType instance");
47        }
48    }
49}
50
51/**
52 * Just an example class as a subject to validation.
53 */
54class MyType {
55    // blahblahblah
56}
57
58
59function proofOfConcept(AbstractList $lst) {
60    $lst->add(new MyType());
61    $lst->add("wrong type"); // Should throw IAE
62}
63
64proofOfConcept(new MyTypeList());
65
Full Screen
copy
1class ExtendedController extends Controller
2{
3  public function addReOrderableModel(ReOrderableModel $model)
4  {
5    return $this->addModel($model);
6  }
7}
8
Full Screen
copy
1class PassMeIn
2{
3
4}
5
6class PassMeInSubClass extends PassMeIn
7{
8
9}
10
11class ClassProcessor
12{
13    public function processClass (PassMeIn $class)
14    {
15        var_dump (get_class ($class));
16    }
17}
18
19class ClassProcessorSubClass extends ClassProcessor 
20{
21    public function processClass (PassMeInSubClass $class)
22    {
23        parent::processClass ($class);
24    }
25}
26
27$a  = new PassMeIn;
28$b  = new PassMeInSubClass;
29$c  = new ClassProcessor;
30$d  = new ClassProcessorSubClass;
31
32$c -> processClass ($a);
33$c -> processClass ($b);
34$d -> processClass ($b);
35
Full Screen
copy
1class ClassProcessor
2{
3    public function processClass (PassMeIn $class)
4    {
5        var_dump (get_class ($class));
6    }
7}
8
9class ClassProcessorSubClass extends ClassProcessor 
10{
11    public function processClass (PassMeIn $class)
12    {
13        if ($class instanceof PassMeInSubClass)
14        {
15            parent::processClass ($class);
16        }
17        else
18        {
19            throw new InvalidArgumentException;
20        }
21    }
22}
23
24$a  = new PassMeIn;
25$b  = new PassMeInSubClass;
26$c  = new ClassProcessor;
27$d  = new ClassProcessorSubClass;
28
29$c -> processClass ($a);
30$c -> processClass ($b);
31$d -> processClass ($b);
32$d -> processClass ($a);
33
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Most used methods in InvalidArgumentException

    No methods found for this class 😞

Run Selenium Automation Tests on LambdaTest Cloud Grid

Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)