<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: eRcumenT</title>
    <description>The latest articles on DEV Community by eRcumenT (@ercument_9c3087266fea8a42).</description>
    <link>https://dev.to/ercument_9c3087266fea8a42</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2143023%2F9207460c-7ebc-4c41-88d7-926a3dfe771b.png</url>
      <title>DEV Community: eRcumenT</title>
      <link>https://dev.to/ercument_9c3087266fea8a42</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ercument_9c3087266fea8a42"/>
    <language>en</language>
    <item>
      <title>Selenium How To Wait Page Loading</title>
      <dc:creator>eRcumenT</dc:creator>
      <pubDate>Sun, 29 Sep 2024 16:45:30 +0000</pubDate>
      <link>https://dev.to/ercument_9c3087266fea8a42/selenium-how-to-wait-page-loading-62m</link>
      <guid>https://dev.to/ercument_9c3087266fea8a42/selenium-how-to-wait-page-loading-62m</guid>
      <description>&lt;p&gt;I am trying to create an application using Selenium. My functions are exactly as follows. After making selections from some dropdown menus, an animation with the class 'loading' appears on the page, during which all elements are removed and then re-added once the loading is complete. I managed to handle this the way I shared, but I believe there is a more efficient way to do it. Could you please help me?&lt;/p&gt;

&lt;p&gt;selectElement: The menu created using ul and li has JavaScript events defined.&lt;/p&gt;

&lt;p&gt;optionElement: After making a selection in the selectElement part, the options within the select are loaded, and I check whether they have been loaded.&lt;/p&gt;

&lt;p&gt;optionToSelect: Consists of the li elements within the selectElement.&lt;/p&gt;

&lt;p&gt;isLoadingExpected: After making some selections, a loading animation appears on the page, which I haven't been able to prevent.&lt;/p&gt;

&lt;p&gt;Here's the video and what I want to do(Blurred for privacy): &lt;a href="https://streamable.com/p47d93" rel="noopener noreferrer"&gt;https://streamable.com/p47d93&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;selectItem(Elements.xxx.xPath, Elements.xxxOptions.xPath, aaa.bbb.xPath, 0);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;`public static void selectItem(String selectElement, String optionElements, String optionToSelect, int isLoadingExpected) throws Exception {&lt;br&gt;
        WebDriverWait waitElement = new WebDriverWait(chromeDriver, Duration.ofSeconds(10));&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    if (isLoadingExpected == 1) {
        waitElement.until(ExpectedConditions.visibilityOfElementLocated(By.className("loading")));
        waitElement.until(ExpectedConditions.invisibilityOfElementLocated(By.className("loading")));
    }

    WebElement selectWebElement = waitElement.until(ExpectedConditions.elementToBeClickable(By.xpath(selectElement)));
    waitElement.until(ExpectedConditions.numberOfElementsToBeMoreThan(By.xpath(optionElements), 1));
    selectWebElement.click();

    WebElement optionWebElement = waitElement.until(ExpectedConditions.elementToBeClickable(By.xpath(optionToSelect)));
    optionWebElement.click();
}`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>java</category>
      <category>selenium</category>
      <category>condition</category>
      <category>wait</category>
    </item>
  </channel>
</rss>
