我想(通常的方式)弄清楚可点击元素的目标网址,而不是被浏览器重定向。这可能在Selenium吗?
注意,clickable元素在Javascript函数中生成目标url。因此,抓住元素的href属性对我来说不是解决方案。
<a href="javascript:void(0);" onclick="redirect()">click me</a>
<script>
function redirect(){
randomPage = Math.round(Math.random()*10000).toString()
window.location.replace("https://jsfiddle.net/random_page_"+randomPage);
}
</script>