
:no_upscale()/cdn.vox-cdn.com/uploads/chorus_asset/file/19557015/Screen_Shot_2019_12_27_at_1.38.11_PM.png)
open the link in new tab, Keys.Chord string passed to sendKeysīy.xpath("//*")). String nwtb = Keys.chord(Keys.CONTROL,Keys.ENTER) tProperty("", "C:\\Users\\ghs6kor\\Desktop\\Java\\chromedriver.exe") ĭriver.manage().timeouts().implicitlyWait(4, TimeUnit.SECONDS) Alternatively, you can press the Command key on the keyboard and click on. You can right-click the link or anchor text you want to open in a new tab and select Open link in a new tab option. + Right arrow or + Left arrow: Google Chrome feature shortcuts. You can turn on Keyboard focus in the 'Keyboard' section of your Macs System Preferences. The operation is the same for Chrome and Safari. Quit Google Chrome + q: Move tabs right or left with keyboard focus. In IE Explorer, it was possible to decide whether links opened in the same or a new page. This never used to happen - you used to click on a link and you went straight to that page. Syntax String nwtb = Keys.chord(Keys.CONTROL,Keys.ENTER) ĭriver.findElement(By.xpath("//*")).sendKeys(nwtb) ExampleĬode Implementation. You can easily open a link in a new tab on Mac by right clicking your mouse or using the new tab shortcut. When I am in a web page and click on a link, I stay on the tab I was originally in, but a separate new tab opens up with the link. The return value of window.open() is a reference to the newly created window or tab or null if it failed. Approach: To open a new tab, we have to use blank in second parameter of window.open(). This is stored as a string value and finally passed as a parameter to the sendKeys method. The window.open() method is used to open a new browser window or a new tab depending on the browser setting and the parameter values. The Keys.CONTROL and Keys.ENTER are passed as parameters to the Keys.chord method here. A group of strings or keys can be passed as parameters to that method.

If you insist on using the mouse, you can Right-Click the title bar in chrome, and select New Tab. If you want to do it from the keyboard, you can use Ctrl-T.
#HOW TO OPEN NEW TAB USING RIGHT CLICK IN MAC CHROME PLUS#
In chrome, it has a small plus (+) in the icon. Multiple keys can be passed simultaneously with the Keys.chord method. Just click on the small tab to the right of the last tab in the browser. The Keys.chord and sendKeys methods are used for this.
