Created
June 20, 2022 12:07
-
-
Save SarahElson/d6af00bbb5e7002e552dd097ee065871 to your computer and use it in GitHub Desktop.
How to select multiple checkboxes in Selenium WebDriver using Java?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test; | |
import java.net.MalformedURLException; | |
import java.net.URL; | |
import org.openqa.Selenium.remote.DesiredCapabilities; | |
import org.openqa.Selenium.remote.RemoteWebDriver; | |
import org.testng.annotations.AfterMethod; | |
import org.testng.annotations.BeforeMethod; | |
public class BaseClass { | |
public RemoteWebDriver driver = null; | |
String username = "<lambdaTest_username>"; | |
String accessKey = "<lambdaTest_accesskey>"; | |
@BeforeMethod | |
public void setUp() { | |
DesiredCapabilities capabilities = new DesiredCapabilities(); | |
capabilities.setCapability("browserName", "Chrome"); | |
capabilities.setCapability("version", "92.0"); | |
capabilities.setCapability("platform", "Windows 10"); | |
capabilities.setCapability("resolution", "1024x768"); | |
capabilities.setCapability("build", "Multiple Checkboxes using Selenium JAVA"); | |
capabilities.setCapability("name", "Multiple Checkboxes using Selenium JAVA"); | |
try { | |
driver = new RemoteWebDriver( | |
new URL("https://" + username + ":" + accessKey | |
+ "@hub.lambdatest.com/wd/hub"), capabilities); | |
} catch (MalformedURLException e) { | |
System.out.println("Invalid grid URL"); | |
} | |
} | |
@AfterMethod | |
public void closeDriver() { | |
driver.quit(); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment