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

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -