【发布时间】:2019-12-31 11:02:09
【问题描述】:
我创建了一个应用程序,允许用户通过我的应用程序登录到 Wikipedia,我使用 selenium 实现了这个目标,但我找不到验证凭据是否正常的方法。
我尝试按 id 查找,但由于失败的条件不显示 ID,因此没有帮助。
private void button1_Click(object sender, EventArgs e)
{
string BaseUrl = "https://en.wikipedia.org/w/index.php?title=Special:UserLogin&returnto=Main+Page";
int TimeOut = 30;
var driver = new FirefoxDriver();
driver.Navigate().GoToUrl(BaseUrl);
var loginBox = driver.FindElement(By.Id("wpName1"));
loginBox.SendKeys("email.address@gmail.com");
var pwBox = driver.FindElement(By.Id("wpPassword1"));
pwBox.SendKeys("!SuperSecretpassw0rd");
我想知道输入的凭据是否正确。
【问题讨论】:
标签: selenium selenium-webdriver css-selectors webdriver webdriverwait