I attempted to use this code, but encountered an issue where it was not focusing on a new tab. Despite right-clicking, the program did not shift focus to a new tab and no error was thrown.
public class AM1 {
public static void main(String[] args) throws InterruptedException {
System.setProperty("webdriver.chrome.driver", "C:\\Selenium\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("https://jira.dematic.com/secure/Dashboard.jspa");
Thread.sleep(2000);
WebElement taskElement = driver.findElement(By.xpath("//a[text()='Create']"));
Actions actions = new Actions(driver);
// Right click on element
actions.contextClick(taskElement).perform();
actions.sendKeys(Keys.ARROW_DOWN).perform();
}
}