![](/img/trans.png)
[英]How to disable cookies in Chrome using Selenium and Java
[英]How to get rid of cookies notification in chrome browser using Selenium Java
我想請你幫我解決這個問題。 我想使用 Java 語言用 Selenium 打開 chrome 窗口。 接下來我想找到輸入元素並在那里放一些文本。 問題是,我無法擺脫 cookie 通知,因為窗口總是在我未登錄谷歌帳戶的情況下打開。 如何打開已登錄到我的帳戶的 chrome 窗口? 或者我怎樣才能擺脫谷歌cookies通知?
非常感謝。
Cookie 經常顯示為警報,因此這可能有效:
WebDriverWait wait = new WebDriverWait(driver,15);//create WebDriverWait
wait.until(ExpectedConditions.alertIsPresent());//Wait for the alert
driver.switchTo().alert().accept();//accept the alert
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.