亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在 Java 中使用 selenium 登錄 facebook

在 Java 中使用 selenium 登錄 facebook

Qyouu 2022-12-15 16:47:56
我嘗試使用 selenium 庫登錄 facebook,但出現了一些問題。輸入憑據并單擊登錄按鈕后,我收到一條錯誤消息:Cookies RequiredCookies are not enabled on your browser. Please enable cookies in your browser preferences to continue.我已經在互聯網上尋找答案,所以我嘗試了driver.manage().getCookies();并且得到了相同的結果。這是我的代碼:System.setProperty("webdriver.chrome.driver", DRIVERLOCATION);WebDriver driver = new ChromeDriver();driver.manage().getCookies();driver.get("https://www.facebook.com");driver.findElement(By.id("email")).sendKeys(USERNAME);driver.findElement(By.id("pass")).sendKeys(PASSWORD);driver.findElement(By.xpath("//input[starts-with(@id, 'u_0_')][@value='Log In']")).click();
查看完整描述

1 回答

?
天涯盡頭無女友

TA貢獻1831條經驗 獲得超9個贊

我知道在問題中我說過我嘗試訪問 www.facebook.com 但在實際項目中我正在訪問個人資料。

當你去https://www.facebook.com時它工作得很好但是error occurs when your going to a profile or if you have second authentication activated.


查看完整回答
反對 回復 2022-12-15
  • 1 回答
  • 0 關注
  • 216 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號