You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a problem in my UI Tests: i used Find.Element(By.LinkText()) and Find.Element(By.CssSelector()) and The tests run fine in local (VS2012 ASP.Net project) but when i deploy my tests in the server i reseive the errors of buid in some tests:
Information: [Error] 'TestStack.Seleno.PageObjects.Actions.ElementFinder' Error invoking ElementFinder.Element
Information: [Error] 'TestStack.Seleno.PageObjects.Actions.ElementFinder' OpenQA.Selenium.NoSuchElementException: Unable to locate element: {"method":"css selector","selector":""} at TestStack.Seleno.Extensions.WebDriverExtensions.ElementWithWait(IWebDriver driver, Func`2 elementIsFound, TimeSpan maxWait)
Information: [Error] 'TestStack.Seleno.PageObjects.Actions.ElementFinder' OpenQA.Selenium.NoSuchElementException: Unable to locate element: {"method":"LinkText"} at TestStack.Seleno.Extensions.WebDriverExtensions.ElementWithWait(IWebDriver driver, Func`2 elementIsFound, TimeSpan maxWait)
I tried to run the tests in different versions of Visual Studio 2012,2013, and 2015 and i find the same error of build but in different tests.
I don't know why find.element doesn't work sometimes?
I have a problem in my UI Tests: i used Find.Element(By.LinkText()) and Find.Element(By.CssSelector()) and The tests run fine in local (VS2012 ASP.Net project) but when i deploy my tests in the server i reseive the errors of buid in some tests:
Information: [Error] 'TestStack.Seleno.PageObjects.Actions.ElementFinder' Error invoking ElementFinder.Element
Information: [Error] 'TestStack.Seleno.PageObjects.Actions.ElementFinder' OpenQA.Selenium.NoSuchElementException: Unable to locate element: {"method":"css selector","selector":""} at TestStack.Seleno.Extensions.WebDriverExtensions.ElementWithWait(IWebDriver driver, Func`2 elementIsFound, TimeSpan maxWait)
Information: [Error] 'TestStack.Seleno.PageObjects.Actions.ElementFinder' OpenQA.Selenium.NoSuchElementException: Unable to locate element: {"method":"LinkText"} at TestStack.Seleno.Extensions.WebDriverExtensions.ElementWithWait(IWebDriver driver, Func`2 elementIsFound, TimeSpan maxWait)
I tried to run the tests in different versions of Visual Studio 2012,2013, and 2015 and i find the same error of build but in different tests.
I don't know why find.element doesn't work sometimes?
Thanks.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
Hi Robdmoore
the tests are running by a powershell script : VSTest
On the build server:it is intermittent,
And i didn't use the screenshots, how can i use it?
That'll be because you don't have jQuery loaded on the page. Some of the things in Seleno like the waitfor.ajaxcallstocomplete depend on jQuery being there.
The fact it's intermittent probably means it's a timing issue. It may happen on the build server rather than local because the build server is a bit slower so things take longer to load.
If you want to put in a wait until a particular element is there then look into the WebDriverWait class (it's part of Selenoium.WebDriver, which Seleno wraps.
In fact, i get the issue of JavaScriptError in local not in the build server.
In the server build, i had another issue of find element: i replaced it by wait.Until(ExpectedConditions.ElementIsVisible(By.Id("id")));but it didn't work
So, i used the way to execute javascript code to click into the element: IJavaScriptExecutor js = (IJavaScriptExecutor)BrowserHost.Instance.Application.Browser; js.ExecuteScript("return document.getElementsByClassName('classname')[0].click();");
And this time it works correctly in the server build :)
Now, i have the same error of WaitFor.AjaxCallsToComplete(); just in local
I tried to use another way to verify that the document is ready and the ajax call are completed by this code: WebDriverWait wait = new WebDriverWait(BrowserHost.Instance.Application.Browser, TimeSpan.FromSeconds(100)); wait.Until(d => (bool)(d as IJavaScriptExecutor).ExecuteScript("return document.readyState").ToString().Equals("complete")); wait.Until(d => (bool)(d as IJavaScriptExecutor).ExecuteScript("return jQuery.active == 0")); and i got an error( jQuery is not a function (UnexpectedJavaScriptError))
It can be related to the navigator FireFox or the speed of the connexion?
Activity
robdmoore commentedon Apr 25, 2016
What is running the tests on the build server? TeamCity? VSTS? ...?
Does it always fail on the build server or is it intermittent?
Have you added code to take screenshots? What do the screenshots show?
wijdenchebbi commentedon Apr 25, 2016
Hi Robdmoore
the tests are running by a powershell script : VSTest
On the build server:it is intermittent,
And i didn't use the screenshots, how can i use it?
Thanks,
wijdenchebbi commentedon May 3, 2016
Hi,
I test the devexpress GridView loading: How can i add Wait.Until the loading of the callback is completed.
I used WaitFor.AjaxCallsToComplete(); but i get this error: $ is undefined (UnexpectedJavaScriptError)
robdmoore commentedon May 8, 2016
That'll be because you don't have jQuery loaded on the page. Some of the things in Seleno like the waitfor.ajaxcallstocomplete depend on jQuery being there.
The fact it's intermittent probably means it's a timing issue. It may happen on the build server rather than local because the build server is a bit slower so things take longer to load.
If you want to put in a wait until a particular element is there then look into the WebDriverWait class (it's part of Selenoium.WebDriver, which Seleno wraps.
wijdenchebbi commentedon May 10, 2016
Thanks for your reply,
In fact, i get the issue of JavaScriptError in local not in the build server.
In the server build, i had another issue of find element: i replaced it by
wait.Until(ExpectedConditions.ElementIsVisible(By.Id("id")));but it didn't workSo, i used the way to execute javascript code to click into the element:
IJavaScriptExecutor js = (IJavaScriptExecutor)BrowserHost.Instance.Application.Browser; js.ExecuteScript("return document.getElementsByClassName('classname')[0].click();");And this time it works correctly in the server build :)
Now, i have the same error of WaitFor.AjaxCallsToComplete(); just in local
I tried to use another way to verify that the document is ready and the ajax call are completed by this code:
WebDriverWait wait = new WebDriverWait(BrowserHost.Instance.Application.Browser, TimeSpan.FromSeconds(100)); wait.Until(d => (bool)(d as IJavaScriptExecutor).ExecuteScript("return document.readyState").ToString().Equals("complete")); wait.Until(d => (bool)(d as IJavaScriptExecutor).ExecuteScript("return jQuery.active == 0"));and i got an error( jQuery is not a function (UnexpectedJavaScriptError))It can be related to the navigator FireFox or the speed of the connexion?
Thanks.