Copy a link and launch it in a new window in Selenium Python -
i have link need copy , paste in new browser window. have following code snippet doesn't seem work. found code snippet in stackoverflow. getting blank window. please advise. thanks!
shorturl = driver.find_element_by_css_selector('#url-text') shorturl.send_keys(keys.control, 'a') #highlight in box time.sleep(5) newlink = shorturl.send_keys(keys.control, 'c') #copy time.sleep(5) actionchains.click(newlink).key_down(keys.command+'w') newlink2 = shorturl.send_keys(keys.control, 'v')
why trying copy link , launch in new window,any specific reason? instead of this,you can click link , open in window.there code action written in java:
actions act = new actions(driver); webelement onelement = driver.findelement(by.linktext("gmail")); act.contextclick(onelement).perform(); act.sendkeys("w").perform();
hope code helps you!!!
Comments
Post a Comment