[英]element not visible Target invocation exception
I am trying to automate login on DropBox https://www.dropbox.com/chooser ,but still facing issues with element not visible, which is weird, even though if the all page is loaded successfully. 我正在尝试自动在DropBox https://www.dropbox.com/chooser上登录,但是仍然遇到元素不可见的问题,这很奇怪,即使已成功加载了所有页面。
Here is the code for filling the password: 这是填写密码的代码:
protected virtual void FillPassword(string password)
{
//Password.Clear();
Password.SendKeys(password);
}
The last line fails on the Target Invocation Exception. 最后一行在目标调用异常上失败。 I also wanted to use Password.Clear();, but this was also failing.
我也想使用Password.Clear();,但这也失败了。
Here is the locator for Password: 这是密码的定位器:
[CacheLookup, FindsBy(How = How.Name, Using = "login_password")]
protected override IWebElement Password { get; set; }
What is going on? 到底是怎么回事? I tried to use wait methods for the page,but it has not helped.
我试图对页面使用等待方法,但没有帮助。 Does anyone know why it crashes?
有谁知道它为什么崩溃?
I changed the HTML locator to: 我将HTML定位符更改为:
[CacheLookup, FindsBy(How = How.CssSelector, Using = ".text-input-wrapper [name=\"login_password\"]")]
protected override IWebElement Password { get; set; }
and this works fine. 而且效果很好。 I am not sure why the name selector cannot find it.
我不确定为什么名称选择器找不到它。 This is misunderstanding to me.
这对我来说是误会。 Both approaches should work.
两种方法都应该起作用。 Here is the page source of the field element:
这是field元素的页面来源:
<div class="text-input-wrapper">
<input id="pyxl14559" class="password-input text-input-input" type="password" name="login_password">
<label for="pyxl14559" style="">Password</label>
<small class="secondary-label"></small>
<div class="password-caps-indicator">Caps lock is currently on</div>
</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.