Wait for element to be displayed/visible Timeout issue...

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Wait for element to be displayed/visible Timeout issue...

mawa316 .
Hi all,

I'm back with another wait involved question.  I have a test record displayed in a grid and I check some things on this record to make sure 'stuff' is working properly...

               

string docTitle = "ASH REF DWG";

         

// Check the status...


                logger.Debug("Checking file status...");


                //driver.FindElementByXPath("//div[contains(text(), 'New')]");


                wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("//div[contains(text(), 'New')]")));



                // Check the version


                logger.Debug("Checking file version...");


                //driver.FindElementByXPath("//div[contains(text(), '0.1')]");


                wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("//div[contains(text(), '0.1')]")));



                logger.Debug("New document present with correct status/version! Checking extracted data...");



                // Check extracted data...


                Thread.Sleep(5000); // Repeated failures here.  Neither wait type passes during nightly test but OK during manual run of test.              


                wait.Until(d => driver.FindElementByXPath("//div[contains(text(), '" + docTitle + "')]").Displayed);


                //wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("//div[contains(text(), '" + docTitle + "')]")));


                logger.Debug("File attribute extracted successfully!");


The displayed record looks like this...


First and second checks for "New" and "0.1" pass through fine, but the check for "ASH REF DWG" (docTitle) fails with Exception: Timed out after 30 seconds.  I have tried both wait types as shown below and even added a Sleep against my better judgment to see if that would help.

At first I thought that maybe it is because that column is not fully expanded and the full text is not displayed.  However, when I inspect the element, it does contain the required text.

All of the above information pertains to when our tests run unattended at night.  The test has failed in the same spot for the last four days and each morning following failure I am able to run the test as is, without issue from Visual Studio.

Does anyone know what the issue might be or how to really pin down or catch what is going on?

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/8fa2e267-1226-4463-916c-320011a0ee62%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Wait for element to be displayed/visible Timeout issue...

Ankit Gupta-2
Implement explicit wait and use the condition PresenceOfElement

On Thu, May 3, 2018 at 8:11 PM, mawa316 <[hidden email]> wrote:
Hi all,

I'm back with another wait involved question.  I have a test record displayed in a grid and I check some things on this record to make sure 'stuff' is working properly...

               

string docTitle = "ASH REF DWG";

         

// Check the status...


                logger.Debug("Checking file status...");


                //driver.FindElementByXPath("//div[contains(text(), 'New')]");


                wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("//div[contains(text(), 'New')]")));



                // Check the version


                logger.Debug("Checking file version...");


                //driver.FindElementByXPath("//div[contains(text(), '0.1')]");


                wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("//div[contains(text(), '0.1')]")));



                logger.Debug("New document present with correct status/version! Checking extracted data...");



                // Check extracted data...


                Thread.Sleep(5000); // Repeated failures here.  Neither wait type passes during nightly test but OK during manual run of test.              


                wait.Until(d => driver.FindElementByXPath("//div[contains(text(), '" + docTitle + "')]").Displayed);


                //wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("//div[contains(text(), '" + docTitle + "')]")));


                logger.Debug("File attribute extracted successfully!");


The displayed record looks like this...


First and second checks for "New" and "0.1" pass through fine, but the check for "ASH REF DWG" (docTitle) fails with Exception: Timed out after 30 seconds.  I have tried both wait types as shown below and even added a Sleep against my better judgment to see if that would help.

At first I thought that maybe it is because that column is not fully expanded and the full text is not displayed.  However, when I inspect the element, it does contain the required text.

All of the above information pertains to when our tests run unattended at night.  The test has failed in the same spot for the last four days and each morning following failure I am able to run the test as is, without issue from Visual Studio.

Does anyone know what the issue might be or how to really pin down or catch what is going on?

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/8fa2e267-1226-4463-916c-320011a0ee62%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAKrer0C8J%2B5-oHFp%2B5g9-BTB0FBXKAqv2zLsg8GBiE105PPM5A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Wait for element to be displayed/visible Timeout issue...

Jonathan Herbaut
I'm not sure the PresenceOfElement will change a lot for this, ElementIsVisible is almost the same for this case because the element is shown.
When you want to check ASH REF DWG, be carefull because with your screenshot it seems like you have ellipsis in your UI, and no direct test can compare a troncated text with your full text.
If your loop works with "New" and "0.1", that's not your XPath that is wrong but your comparison in the wait.

2018-05-04 6:18 GMT+02:00 Ankit Gupta <[hidden email]>:
Implement explicit wait and use the condition PresenceOfElement

On Thu, May 3, 2018 at 8:11 PM, mawa316 <[hidden email]> wrote:
Hi all,

I'm back with another wait involved question.  I have a test record displayed in a grid and I check some things on this record to make sure 'stuff' is working properly...

               

string docTitle = "ASH REF DWG";

         

// Check the status...


                logger.Debug("Checking file status...");


                //driver.FindElementByXPath("//div[contains(text(), 'New')]");


                wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("//div[contains(text(), 'New')]")));



                // Check the version


                logger.Debug("Checking file version...");


                //driver.FindElementByXPath("//div[contains(text(), '0.1')]");


                wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("//div[contains(text(), '0.1')]")));



                logger.Debug("New document present with correct status/version! Checking extracted data...");



                // Check extracted data...


                Thread.Sleep(5000); // Repeated failures here.  Neither wait type passes during nightly test but OK during manual run of test.              


                wait.Until(d => driver.FindElementByXPath("//div[contains(text(), '" + docTitle + "')]").Displayed);


                //wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("//div[contains(text(), '" + docTitle + "')]")));


                logger.Debug("File attribute extracted successfully!");


The displayed record looks like this...


First and second checks for "New" and "0.1" pass through fine, but the check for "ASH REF DWG" (docTitle) fails with Exception: Timed out after 30 seconds.  I have tried both wait types as shown below and even added a Sleep against my better judgment to see if that would help.

At first I thought that maybe it is because that column is not fully expanded and the full text is not displayed.  However, when I inspect the element, it does contain the required text.

All of the above information pertains to when our tests run unattended at night.  The test has failed in the same spot for the last four days and each morning following failure I am able to run the test as is, without issue from Visual Studio.

Does anyone know what the issue might be or how to really pin down or catch what is going on?

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/8fa2e267-1226-4463-916c-320011a0ee62%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAKrer0C8J%2B5-oHFp%2B5g9-BTB0FBXKAqv2zLsg8GBiE105PPM5A%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAH1BzpUcS2Jo9wthssy7ubBt2k7LfjCrLcEVMi2g05R0LpYFGg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Wait for element to be displayed/visible Timeout issue...

mawa316 .
I will try the explicit wait + PresenceOfElement.

Does the wait search for the text displayed when I inspect the element, which is the full string mentioned or string displayed with the ellipsis.

On Fri, May 4, 2018 at 3:10 AM, Jonathan Herbaut <[hidden email]> wrote:
I'm not sure the PresenceOfElement will change a lot for this, ElementIsVisible is almost the same for this case because the element is shown.
When you want to check ASH REF DWG, be carefull because with your screenshot it seems like you have ellipsis in your UI, and no direct test can compare a troncated text with your full text.
If your loop works with "New" and "0.1", that's not your XPath that is wrong but your comparison in the wait.

2018-05-04 6:18 GMT+02:00 Ankit Gupta <[hidden email]>:
Implement explicit wait and use the condition PresenceOfElement

On Thu, May 3, 2018 at 8:11 PM, mawa316 <[hidden email]> wrote:
Hi all,

I'm back with another wait involved question.  I have a test record displayed in a grid and I check some things on this record to make sure 'stuff' is working properly...

               

string docTitle = "ASH REF DWG";

         

// Check the status...


                logger.Debug("Checking file status...");


                //driver.FindElementByXPath("//div[contains(text(), 'New')]");


                wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("//div[contains(text(), 'New')]")));



                // Check the version


                logger.Debug("Checking file version...");


                //driver.FindElementByXPath("//div[contains(text(), '0.1')]");


                wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("//div[contains(text(), '0.1')]")));



                logger.Debug("New document present with correct status/version! Checking extracted data...");



                // Check extracted data...


                Thread.Sleep(5000); // Repeated failures here.  Neither wait type passes during nightly test but OK during manual run of test.              


                wait.Until(d => driver.FindElementByXPath("//div[contains(text(), '" + docTitle + "')]").Displayed);


                //wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("//div[contains(text(), '" + docTitle + "')]")));


                logger.Debug("File attribute extracted successfully!");


The displayed record looks like this...


First and second checks for "New" and "0.1" pass through fine, but the check for "ASH REF DWG" (docTitle) fails with Exception: Timed out after 30 seconds.  I have tried both wait types as shown below and even added a Sleep against my better judgment to see if that would help.

At first I thought that maybe it is because that column is not fully expanded and the full text is not displayed.  However, when I inspect the element, it does contain the required text.

All of the above information pertains to when our tests run unattended at night.  The test has failed in the same spot for the last four days and each morning following failure I am able to run the test as is, without issue from Visual Studio.

Does anyone know what the issue might be or how to really pin down or catch what is going on?

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/8fa2e267-1226-4463-916c-320011a0ee62%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAKrer0C8J%2B5-oHFp%2B5g9-BTB0FBXKAqv2zLsg8GBiE105PPM5A%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/JYTJCovWZgg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAH1BzpUcS2Jo9wthssy7ubBt2k7LfjCrLcEVMi2g05R0LpYFGg%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAAYdofa0x8jBwWWuQ6NUg_FRknfBp5%3Ds4V8%3DkWer4Jp0YW5Ypw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Wait for element to be displayed/visible Timeout issue...

mawa316 .
So, I let the test run for several days and it consistently still fails in the same spot after ...

logger.Debug("New document present with correct status/version! Checking extracted data...");

The Thread.Sleep has been removed and I've swapped between these two, as shown above...

//wait.Until(d => driver.FindElementByXPath("//div[contains(text(), '" + docTitle + "')]").Displayed);

wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("//div[contains(text(), '" + docTitle + "')]")));

docTitle is now ARD1

The exception I receive now is - Timed out after 30 seconds.  What should this be telling me?

I am completely baffled at this point.  I have had problem areas in tests before, but I was usually able to work through them with a small tweak of some sort.  This problem will just not go away.


On Sun, May 6, 2018 at 7:32 AM, mawa316 <[hidden email]> wrote:
I will try the explicit wait + PresenceOfElement.

Does the wait search for the text displayed when I inspect the element, which is the full string mentioned or string displayed with the ellipsis.

On Fri, May 4, 2018 at 3:10 AM, Jonathan Herbaut <[hidden email]> wrote:
I'm not sure the PresenceOfElement will change a lot for this, ElementIsVisible is almost the same for this case because the element is shown.
When you want to check ASH REF DWG, be carefull because with your screenshot it seems like you have ellipsis in your UI, and no direct test can compare a troncated text with your full text.
If your loop works with "New" and "0.1", that's not your XPath that is wrong but your comparison in the wait.

2018-05-04 6:18 GMT+02:00 Ankit Gupta <[hidden email]>:
Implement explicit wait and use the condition PresenceOfElement

On Thu, May 3, 2018 at 8:11 PM, mawa316 <[hidden email]> wrote:
Hi all,

I'm back with another wait involved question.  I have a test record displayed in a grid and I check some things on this record to make sure 'stuff' is working properly...

               

string docTitle = "ASH REF DWG";

         

// Check the status...


                logger.Debug("Checking file status...");


                //driver.FindElementByXPath("//div[contains(text(), 'New')]");


                wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("//div[contains(text(), 'New')]")));



                // Check the version


                logger.Debug("Checking file version...");


                //driver.FindElementByXPath("//div[contains(text(), '0.1')]");


                wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("//div[contains(text(), '0.1')]")));



                logger.Debug("New document present with correct status/version! Checking extracted data...");



                // Check extracted data...


                Thread.Sleep(5000); // Repeated failures here.  Neither wait type passes during nightly test but OK during manual run of test.              


                wait.Until(d => driver.FindElementByXPath("//div[contains(text(), '" + docTitle + "')]").Displayed);


                //wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("//div[contains(text(), '" + docTitle + "')]")));


                logger.Debug("File attribute extracted successfully!");


The displayed record looks like this...


First and second checks for "New" and "0.1" pass through fine, but the check for "ASH REF DWG" (docTitle) fails with Exception: Timed out after 30 seconds.  I have tried both wait types as shown below and even added a Sleep against my better judgment to see if that would help.

At first I thought that maybe it is because that column is not fully expanded and the full text is not displayed.  However, when I inspect the element, it does contain the required text.

All of the above information pertains to when our tests run unattended at night.  The test has failed in the same spot for the last four days and each morning following failure I am able to run the test as is, without issue from Visual Studio.

Does anyone know what the issue might be or how to really pin down or catch what is going on?

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/8fa2e267-1226-4463-916c-320011a0ee62%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAKrer0C8J%2B5-oHFp%2B5g9-BTB0FBXKAqv2zLsg8GBiE105PPM5A%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/JYTJCovWZgg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAH1BzpUcS2Jo9wthssy7ubBt2k7LfjCrLcEVMi2g05R0LpYFGg%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAAYdofYGFWOQzmho7aA2WKjd4PCrUbvLKeEdPDxAqSHPmJ3oqA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.