簡體   English   中英

在 Internet Explorer 中使用 selenium 的 JavascriptExecutor 打開一個新選項卡

[英]Open a new tab using JavascriptExecutor of selenium in Internet Explorer

我在用

((JavascriptExecutor) driver).executeScript("window.open();");

打開一個新選項卡。 它在 Chrome 中使用 selenium 驅動程序可以正常工作,但在 IE 中不能正常工作,有什么建議嗎? 謝謝

也試過這個:但沒有運氣

 ((JavascriptExecutor) driver).executeScript("window.open('http://www.google.com','_blank');");

以下可能對您有用:

String theURL = "type the url in here"; 
((JavascriptExecutor)driver).executeScript("window.open(arguments[0]),theURL");

回答是否有人遇到同樣的問題

第1步:

Internet 選項 > 常規選項卡 > 單擊設置 > 單擊選項卡 > 選擇遇到彈出窗口時始終在新選項卡中打開彈出窗口

第2步:

現在轉到隱私和添加網站以允許彈出窗口

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM