There is a similar question concerning Watir-WebDriver.
What is the best way to do Ctrl+click on a DOM element?
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It only takes a minute to sign up.Sign up to join this community
A Google search of "webdriver ctrl click" turned up this result:
Ctrl+click requires three actions: a send_keys action to press the CTRL key, then a click action, and then another send_keys action to release the CTRL key.
for clicking on the link which expected to be opened from new tab use this
WebDriver driver = new ChromeDriver(); driver.get("https://www.yourSite.com"); WebElement element=driver.findElement(By.xpath("path_to_link")); Actions actions = new Actions(driver); actions.keyDown(Keys.LEFT_CONTROL) .click(element) .keyUp(Keys.LEFT_CONTROL) .build() .perform(); ArrayList<String> tab = new ArrayList<>(driver.getWindowHandles()); driver.switchTo().window(tab.get(1));
I think your best bet is to use Actions which is described here:
You will want to execute the key_down action (for the CONTROL key), then the click action, then the key_up action.
The key codes for non-letter keys are listed here: https://selenium-python.readthedocs.io/api.html#module-selenium.webdriver.common.action_chains
The element is nothing but the variable to find the properties of the object so we are using WebElement to find it
WebElement obj = findElement(By.Xpath("")).click(); obj.sendkeys("xxxxx");
If you guys want to click submit button you can use code
obi.submit(). This code navigates to the next page. It acts as the button