Chrome无法自动填充用户名和密码

Chrome无法自动填充用户名和密码

一般地,Chrome会在页面加载时即会自动填充用户保存的用户名和密码,但是有的时候只能通过用户通过下拉列表明确选择某一账户时才会自动填充。
解决方法是在chrome://flags/里将“Fill passwords on account selection on HTTP origins”及“Fill passwords on account selection”选项置为Disabled。具体解释为:

Fill passwords on account selection
Filling of passwords when an account is explicitly selected by the user rather than autofilling credentials on page load. – Mac, Windows, Linux, Chrome OS, Android

Fill passwords on account selection on HTTP origins
Filling of passwords when an account is explicitly selected by the user rather than autofilling credentials on page load on HTTP origins. – Mac, Windows, Linux, Chrome OS, Android

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
要实现Java自动输入用户名密码并实现网站自动登录,可以使用Java的Selenium库。Selenium是一个功能强大的自动化测试工具,可以模拟用户在网页上的动作。 首先,需要下载并配置Selenium WebDriver。然后,我们可以编写一个Java程序来实现自动登录。 在程序中,我们需要使用WebDriver打开浏览器,并通过driver.get()方法访问目标网站。 接下来,我们可以使用driver.findElement()方法找到用户名密码的输入框。然后,使用sendKeys()方法输入对应的用户名密码。 最后,我们可以使用driver.findElement()方法找到登录按钮,并使用click()方法模拟点击操作,以实现自动登录。 以下是一个简单的示例代码: ```java import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; public class AutoLoginExample { public static void main(String[] args) { // 设置驱动路径 System.setProperty("webdriver.chrome.driver", "path_to_chrome_driver"); // 创建WebDriver实例 WebDriver driver = new ChromeDriver(); // 打开目标网站 driver.get("http://example.com"); // 找到用户名输入框并输入用户名 WebElement usernameInput = driver.findElement(By.id("username")); usernameInput.sendKeys("your_username"); // 找到密码输入框并输入密码 WebElement passwordInput = driver.findElement(By.id("password")); passwordInput.sendKeys("your_password"); // 找到登录按钮并模拟点击 WebElement loginButton = driver.findElement(By.id("login-button")); loginButton.click(); // 关闭浏览器 driver.quit(); } } ``` 这是一个简单的自动登录示例,你需要根据你要自动登录的网站的具体HTML标签和元素来修改代码。同时,你需要根据你的实际情况设置正确的Chrome驱动路径。 希望这个回答能够帮到你实现自动化登录,如果有任何问题,请随时提问。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值