问题
Selenium IDE : I am trying to open a link in new tab using controlkey or contextmenu and both commands did not work.
USING CONTROLKEY : 1). verify element present 2)controlkeydown() 3) click link 4) controlkeyup(). when executed, it displays the error unknown command (control key().
USING CONETXTMENU : 1 ) Verify element present 2) contextmenu target link=linkname 3) click target = link
回答1:
My advise to you will be to not test this. Both of the items you are trying to test are features of the browser itself and not of the web application. So if your aim is to test the web application, you are not adding any value by testing the browser.
回答2:
How about extracting href attribute from link and using it to open a new window with separate command?
|storeAttribute | SOME_LOCATOR@href | mylink |
|openWindow | ${mylink} | |
EDIT: more specific example
|open | http://twitter.com | |
|storeAttribute | link=About@href | mylink |
|openWindow | ${mylink} | |
This opens Twitter's About page in new window.
来源:https://stackoverflow.com/questions/18273307/how-to-open-link-in-new-tab