My test page has a link that opens by default in a new TAB. I need to open a link and check some values ββon a newly opened page. Since I found that selenium does not support tabbed browsing, so I am trying to open the link in a new window, but it still does not work. I implemented a python function to store the SHIFT key (I did this before for CTRL and it works), and then I called the "click" function, but the link still opens in a new tab
from robot.libraries.BuiltIn import BuiltIn
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
class CustomSeleniumLibrary(object):
def __init__(self):
self.driver = None
self.library = None
self.ac = None
def get_library_instance(self):
if self.library is None:
self.library = BuiltIn().get_library_instance('ExtendedSelenium2Library')
return self.library
def get_action_chain(self):
if self.ac is None:
self.ac = ActionChains(self.get_library_instance()._current_browser())
return self.ac
def hold_shift(self):
actionChain = self.get_action_chain()
actionChain.key_down(Keys.SHIFT)
actionChain.perform()
Keyword robot
Open project detail
wait until element is visible ${LINK_TO_PROJECT}
${project}= get text ${LINK_TO_PROJECT}
hold shift
click element ${LINK_TO_PROJECT}
element should contain //h3 Project Details: ${project}
, .., . ( ), , DOM .. !