因此,我正在尝试创建一个脚本,该脚本将自动在此网站上为我登录:
到目前为止,这是我的脚本:
Alamofire.request(_evolutionURL).responseJSON { response in
if let dict = response.result.value as? Dictionary<String, AnyObject> {
if let evoLvl = dict["min_level"] as? String {
self._nextEvolutionLvl = evoLvl
}
}
}
因此,我尝试使用以下代码行输入我的用户名:
Sub openBrowser()
'Open new browser
Set driver = New Selenium.ChromeDriver
'Navigate to Website
urlWebsite = "https://teespring.com/login"
driver.Get urlWebsite
但是我收到一个错误消息,说元素不可见
还有什么方法可以使登录过程自动化?
感谢您的帮助,如果您需要更多信息,我将尽我所能,因为我仍在学习如何处理vba硒:-)
答案 0 :(得分:1)
它不可见,因为它在表单内部。
您需要通过表单访问:
Option Explicit
Public Sub EnterInfo()
Dim d As WebDriver
Set d = New ChromeDriver
Const URL = "https://teespring.com/login"
With d
.Start "Chrome"
.get URL
With .FindElementByClass("js-email-login-form")
.FindElementByCss("input[name=email]").SendKeys "myEmail"
.FindElementByCss("input[name=password]").SendKeys "myPassWord"
.FindElementByCss("input[type=submit]").Click
End With
Stop '<== Delete me after inspection
.Quit
End With
End Sub