--
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 selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/c5d75f09-d2b7-4fee-8ebc-8abf15d3b362%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I wish there were a way to 100% reliably tell when all the page, with all javascript execution, with everything complete. Unfortunately, there isn't. The best I've found is:/*** isLoaded method is used to check whether Home page is loaded successfully.** @return boolean - This method returns boolean value true if the element is visible else false* @see HomePage#isLoaded()**/public boolean isLoaded(){Log.info("Entering method HomePage::isLoaded()");boolean bFlag = false;Wait<WebDriver> wait = new WebDriverWait(wDriver, 60);wait.until(wDriver -> String.valueOf(((JavascriptExecutor) wDriver).executeScript("return document.readyState")).equals("complete"));Utility.waitForJavascript(5000, 500, wDriver);bFlag = Utility.isElementDisplayed(homepageCarousel, wDriver, 60);Log.info("Exiting the method HomePage::isLoaded() with return value: '" + bFlag + "'");return bFlag;}This works about 97% of the time.
Thanks!GregGreg Martz
Test Analyst III - eBusiness Lead QA Automation Analyst | (425)416-5039 | gma...@Costco.com"Confidentiality Notice: This e-mail message, including any attachments, is for the sole use to the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message."
On Sun, Jun 17, 2018 at 11:55 PM, Nagendra Kuppala <nagendraku...@gmail.com> wrote:
Hi Guys,Is there a way to make the selenium to wait for DOM to completely load before performing next action ?My test cases work as expected 90% of the time. But whenever the application had a patch, application loads bit slow for the first attempt making my test cases fail randomly. I tried using pause for 1min where ever I feel like the application slows down.I know about implicit and explicit waits, which I don't prefer for this case.I want to make my code to check DOM loaded complete before executing next step.Thanks in advance.
--
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 selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/c5d75f09-d2b7-4fee-8ebc-8abf15d3b362%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 selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAJ5e%3DegWrMFjhOJ8bREWxN3cvZrXen_%2BwaENz2JHsatA-1SqSQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Thanks & Regards
Krishnan Mahadevan
"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/
Greg
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/c5d75f09-d2b7-4fee-8ebc-8abf15d3b362%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 selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAJ5e%3DegWrMFjhOJ8bREWxN3cvZrXen_%2BwaENz2JHsatA-1SqSQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--Thanks & Regards
Krishnan Mahadevan"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/My Technical Scribbings @ http://rationaleemotions.wordpress.com/
--
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 selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CANikZLmLuRbsBt22oU8nqUmTFgSBF4BYL17Wz67yOYd%3DiwzC7w%40mail.gmail.com.
Interesting! I know that I went from about a 35% failure rate to less than 3% after adding that in our isLoaded() class. I so wish that the webdriver would give us a method that would guarantee that the full page has been loaded.
Thanks!GregGreg Martz
Test Analyst III - eBusiness Lead QA Automation Analyst | (425)416-5039 | gma...@Costco.com"Confidentiality Notice: This e-mail message, including any attachments, is for the sole use to the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message."
Greg
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/c5d75f09-d2b7-4fee-8ebc-8abf15d3b362%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 selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAJ5e%3DegWrMFjhOJ8bREWxN3cvZrXen_%2BwaENz2JHsatA-1SqSQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
----Thanks & Regards
Krishnan Mahadevan"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/My Technical Scribbings @ http://rationaleemotions.wordpress.com/
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 selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CANikZLmLuRbsBt22oU8nqUmTFgSBF4BYL17Wz67yOYd%3DiwzC7w%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 selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAJ5e%3DeiGnh4_23wrSDSsi1Bz4Fnx12dhu7LVMgKijbWpq9r%3Dfg%40mail.gmail.com.
--
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 selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAJ5e%3DeiGnh4_23wrSDSsi1Bz4Fnx12dhu7LVMgKijbWpq9r%3Dfg%40mail.gmail.com.
--
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 selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAKrer0CbQz_J2qJSYWVGgbLzBxYRV3HxAh2ds6%3DYRSUX1xbm0w%40mail.gmail.com.
--
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 selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/4500b6a3-040b-4c43-b6ac-1172e7a9f48a%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/4500b6a3-040b-4c43-b6ac-1172e7a9f48a%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 selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAJ5e%3Deg%2BKewpeb5iEoPw6Jubb-ehHZ%2BPu-KSr_ChW6tZdx9M0Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/4500b6a3-040b-4c43-b6ac-1172e7a9f48a%40googlegroups.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/Ewbvaeb68GM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAJ5e%3Deg%2BKewpeb5iEoPw6Jubb-ehHZ%2BPu-KSr_ChW6tZdx9M0Q%40mail.gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/4500b6a3-040b-4c43-b6ac-1172e7a9f48a%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 selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAJ5e%3Deg%2BKewpeb5iEoPw6Jubb-ehHZ%2BPu-KSr_ChW6tZdx9M0Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--Thanks & Regards
Krishnan Mahadevan"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/My Technical Scribbings @ http://rationaleemotions.wordpress.com/
--
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 selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CANikZLkHp137ebk1yv_vUYT4o6pqmOtav%3DvEtHu5dE9QUtTfAA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAJ5e%3Deg%2BKewpeb5iEoPw6Jubb-ehHZ%2BPu-KSr_ChW6tZdx9M0Q%40mail.gmail.com.
--
--
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 selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CADP8btR%3Dmmw%3DV7r1UwM2mXkC6fN7MWpV0QsXZ07MgaJNJgzwNA%40mail.gmail.com.
public static void WaitForDocumentReady(this IWebDriver driver)
{
Console.WriteLine("Waiting for five instances of document.readyState returning 'complete' at 100ms intervals.");
IJavaScriptExecutor jse = (IJavaScriptExecutor)driver;
int i = 0; // Count of (document.readyState === complete) && (ae.isProcessing === false)
int j = 0; // Count of iterations in the while() loop.
int k = 0; // Count of times i was reset to 0.
bool readyState = false;
while (i < 5)
{
System.Threading.Thread.Sleep(100);
string scriptText = "return (document.readyState === 'complete')";
readyState = (bool)jse.ExecuteScript(scriptText);
if (readyState) { i++; }
else
{
i = 0;
k++;
}
j++;
if (j > 300) { throw new TimeoutException("Timeout waiting for document.readyState to be complete."); }
}
j *= 100;
Console.WriteLine("Waited " + j.ToString() + " milliseconds. There were " + k + " resets.");
}