Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法使用Excel VBA Selenium登录_Vba_Excel_Selenium - Fatal编程技术网

无法使用Excel VBA Selenium登录

无法使用Excel VBA Selenium登录,vba,excel,selenium,Vba,Excel,Selenium,因此,我正在尝试创建一个脚本,该脚本将自动为我登录此网站: 这是我目前的脚本: Sub openBrowser() 'Open new browser Set driver = New Selenium.ChromeDriver 'Navigate to Website urlWebsite = "https://teespring.com/login" driver.Get urlWebsite 因此,我尝试使用以下代码行输入我的用户名: driver.FindElementByCss

因此,我正在尝试创建一个脚本,该脚本将自动为我登录此网站:

这是我目前的脚本:

Sub openBrowser()

'Open new browser
Set driver = New Selenium.ChromeDriver

'Navigate to Website
urlWebsite = "https://teespring.com/login"
driver.Get urlWebsite
因此,我尝试使用以下代码行输入我的用户名:

driver.FindElementByCss("").sendKeys Username
但我得到一个错误,说元素不可见

我还有什么办法可以自动完成登录过程吗


感谢您的帮助,如果您需要更多信息,我将尽我最大的努力,因为我仍在学习如何处理vba selenium:-)

它不可见,因为它位于表单中

您需要通过以下表单访问:

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
选项显式
公共子企业信息()
dimdaswebdriver
设置d=新的色度驱动器
常量URL=”https://teespring.com/login"
与d
.启动“Chrome”
.获取URL
With.FindElementByClass(“js电子邮件登录表单”)
.FindElementByCss(“输入[名称=电子邮件]”).SendKeys“myEmail”
.FindElementByCss(“输入[名称=密码]”).SendKeys“我的密码”
.FindElementByCss(“输入[type=submit]”)。单击
以

“停止”您可能需要等待加载该特定页面元素,然后才能尝试与之交互。类似于:
do while el is nothing:on error resume next:set el=driver.findelementbycss(“”):on error goto 0:loop
——可能具有DoEvents或辅助退出条件以防止无限循环