开发者

Selenium click right on mouse or press option key form keyboard

Using selenium how can I click on the right click of mouse or press on the option key from keyboard(This key is usually available between right ALT and CTRL开发者_JAVA百科 key)


If you are trying to open the context menu, there is a selenium.contextMenu(locator) . This is the menu that opens up when you right click or press that option key.

This example shows you how to open a page element in a new tab from context menu. The page used for example is seleniumhq.org. This code will right click on the logo link and open the page in a new tab

selenium.contextMenu(link=Selenium);

//In the below line of code "t" is the shortcut to open the page in a new tab
selenium.keyPress("link=Selenium","t");

Hope this helps.

Selenium click right on mouse or press option key form keyboard

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜