Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/17.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 等待验证码字段填充四个数字_Excel_Vba_Selenium - Fatal编程技术网

Excel 等待验证码字段填充四个数字

Excel 等待验证码字段填充四个数字,excel,vba,selenium,Excel,Vba,Selenium,这不是一个试图克服验证码,我已经编码的代码,以便让用户键入验证码出现在验证码字段中 我想做的是,在验证码字段被填满之前,我会一直排着队等待,但没有找到办法 所以我试过这样的台词 Do Application.Wait Now + TimeValue("00:00:01") Loop Until Len(.FindElementById("txtCaptcha").Text) = 4 但是在调试时,在我输入了一些数字之后,我没有得到元素的文本。我怎样才能达到这一点呢 我有另一个解

这不是一个试图克服验证码,我已经编码的代码,以便让用户键入验证码出现在验证码字段中

我想做的是,在验证码字段被填满之前,我会一直排着队等待,但没有找到办法 所以我试过这样的台词

Do
    Application.Wait Now + TimeValue("00:00:01")
    Loop Until Len(.FindElementById("txtCaptcha").Text) = 4
但是在调试时,在我输入了一些数字之后,我没有得到元素的文本。我怎样才能达到这一点呢

我有另一个解决办法,就是设置这样一条线

Application.Wait Now + TimeValue("00:00:10")

这将等待10秒,直到用户键入数字,但我想使用Do循环等待,直到…

它必须是元素值。尝试在浏览器控制台中获取innerText或value。使用document.querySelectortxtCaptcha.value或document.querySelectortxtCaptcha.innerText。

它位于基于其他问题的iframe中。在.get行中使用iframe src。在使用selenium时,适当的语法如下所示。DoEvents允许用户输入值

Do
    DoEvents
Loop While Len(.FindElementById("txtCaptcha").Attribute("value")) < 4

我在VBA中使用Selenium,我尝试了.Text和Attributevalue,但没有返回用户键入的值。我认为这是一个很好的观点,但如何实现document.querySelectortxtCaptcha.value以在代码中使用非常感谢您的帮助。这很有魅力。