网页自动填充表单

 

navigationItem.rightBarButtonItem = UIBarButtonItem(title: "自动填充", style: UIBarButtonItemStyle.Plain, target: self, action: "autoFill")
/// 自动填充用户信息
    @objc private func autoFill() {
        let js = "document.getElementById('userId').value = '你的用户名';" +
            "document.getElementById('passwd').value = '你的密码';"
        
        // 执行 js 脚本
        webView.stringByEvaluatingJavaScriptFromString(js)
    }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-03
  • 2021-12-29
  • 2021-12-19
  • 2021-12-28
猜你喜欢
  • 2022-12-23
  • 2021-05-25
  • 2022-12-23
  • 2022-01-06
  • 2021-12-19
  • 2021-09-06
  • 2022-12-23
相关资源
相似解决方案