selenium unable to find element
public void User_LogIn() {
Pages.Login.GoTo();
//Thread.Sleep(50000);
TimeSpan ti =new TimeSpan( 5000000000000);
WebDriverWait wait = new WebDriverWait(webDriver,ti );
wait.Until(ExpectedConditions.VisibilityOfAllEleme ntsLocatedBy(By.Id("txtUserName")));
// webDriver.Manage().Timeouts().ImplicitlyWait(30, TimeUnit.SECONDS);
var txtName = Browser.webdriver.FindElement(By.Id("txtUserName") );
txtName.SendKeys("14");
var txtPass = webDriver.FindElement(By.Id("txtPassword"));
txtPass.SendKeys("14");
var btnSend = webDriver.FindElement(By.Id("btnSubmit"));
btnSend.Click();
var checkName = Browser.webdriver.FindElement(By.Id("ctl00_lblName ")).Text;
var checkId = Browser.webdriver.FindElement(By.Id("ctl00_lblPern o")).Text;
var checkJobGroup =
webDriver.FindElement(
By.XPath("/html/body/form/div[3]/table/tbody/tr[2]/td/table/tbody/tr/td[1]/table/tbody/tr[8]/td[4]"))
.Text;
var section =
webDriver.FindElement(
By.XPath("/html/body/form/div[3]/table/tbody/tr[2]/td/table/tbody/tr/td[1]/table/tbody/tr[8]/td[2]"))
.Text;
Assert.AreEqual(true,VerifyElement(checkId,checkNa me,checkJobGroup,section));
}
المنت های صفحه را پیدا نمی کند حتی با اینکه منتظر می ماند
نقل قول: selenium unable to find element
سلام خیلی کداتو پیچیده کردی شما ابتدا webdriver رو navigate کن به صفحه لاگین بعد شروع به خوندن tag های DOM کن .لازم به timespan نیست در بخش تنظیمات webdriver برای کل driver شما timout ست میکنی لازم به استفاده از متد wait آن نیست.
https://automatetheplanet.com/gettin...ted-webdriver/
using (IWebDriver driver = new ChromeDriver())
{
driver.Manage().Timeouts().SetPageLoadTimeout(Time Span.FromSeconds(120));
driver.Navigate().GoToUrl("https://www.example.com/login");
var txtName = driver.FindElement(By.Id("txtUserName"));
txtName.SendKeys("14");
var txtPass = driver.FindElement(By.Id("txtPassword"));
txtPass.SendKeys("14");
driver.FindElement(By.Id("btnSubmit")).Click();
var checkName = driver.FindElement(By.Id("ctl00_lblName")).Text;
var checkId = driver.FindElement(By.Id("ctl00_lblPerno")).Text;
}
نقل قول: selenium unable to find element
http://stackoverflow.com/questions/2...losed-window-i
مشکل رجیستری داره با Ie11
من نتیجه گرفتم با کمک این صفحه ...چنانچه کسی مشکل مشابه داشت از این لینک استفاده کنه
نقل قول: selenium unable to find element
می تونی بجای درایور IE از درایور Chrome یا Firefox استفاده کنی مشکل رجیستری هم ندارند.
http://www.seleniumhq.org/download/