我不是网页设计的大师,但我可以建议以下场景:
// Get required page
// Excecute below JavaScript with JavaScriptExecutor
var reference = document.querySelector('a#someID').getAttribute('href'); // You can use your specific CSS Selector instead of "a#someID"
document.querySelector('a#someID').setAttribute("onclick", "window.open('" + reference + "', '', 'width=800,height=600')")
document.querySelector('a#someID').removeAttribute('href')
// Find target link
// Click on it
此代码应允许您在目标web元素的源代码中进行更改,以强制在新的浏览器窗口中打开它 .
Note 使用此代码元素在页面上的外观将被更改,直到页面刷新
附:你没有提到你的编程语言,所以没有完整的实现......但是,这是 Python 实现示例:
from selenium import webdriver as web
dr = web.Chrome()
dr.get('https://login.live.com/login.sr