Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 8 of 8

Thread: The element does not have time to load on the page

  1. #1
    Junior Member
    Join Date
    Dec 2021
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default The element does not have time to load on the page

    I work with autotests and a web driver and my problem is that the element does not have time to load, although I added explicit and implicit expectation, I really need your help because I am in a stupor.
    It's sad but I couldn't insert a code snippet,pls take a look at github repo in helloebDriver.java
    github.com/KirillPochta/TestNWebDriver.git

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: The element does not have time to load on the page

    Please post the code you have questions about here on the forum. No links.
    Be sure to wrap the code in code tags.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Dec 2021
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: The element does not have time to load on the page

    Class with tests
    public class HelloWebDriver {
     
        private WebDriver driver;
        private ChromeOptions options;
        private LoginPage loginPageObj;
        private HomePage homePage;
        private WebDriverWait wait;
     
        @Before
        public void browserSetup() {
            System.out.println("aaa");
            options = new ChromeOptions();
            options.setPageLoadStrategy(PageLoadStrategy.NONE);
            options.addArguments("start-maximized");
            options.addArguments("disable-infobars");
            driver = new ChromeDriver(options);
            driver.manage().timeouts().implicitlyWait(5000,
                    TimeUnit.MILLISECONDS);
            driver.manage().timeouts().pageLoadTimeout(5000,
                    TimeUnit.MILLISECONDS);
            driver.manage().timeouts().setScriptTimeout(5000,
                    TimeUnit.MILLISECONDS);
            driver.manage().timeouts().implicitlyWait(50, TimeUnit.SECONDS);
     
            System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
            driver.get("https://junior.webquik.ru/");
            wait = new WebDriverWait(driver,10);
        }
        @org.junit.Test
        public  void signIntoSystem() throws InterruptedException {
     
            wait.until(ExpectedConditions.presenceOfElementLocated
                    (By.id("textfield-1015-inputEl")));
            wait.until(ExpectedConditions.presenceOfElementLocated
                    (By.id("textfield-1017-inputEl")));
            wait.until(ExpectedConditions.presenceOfElementLocated
                    (By.id("button-1021-btnIconEl")));
            loginPageObj = new LoginPage(driver);
     
            loginPageObj.singIntoSystemAsUser("U0191767","06258");
            Assert.assertEquals(driver.getTitle(),"webQUIK 7.6.2");
        }
        @After
        public void closeBrowser() {
            driver.quit();
            driver = null;
        }
    }
    LoginPage
    public class LoginPage {
        private WebDriver driver = new ChromeDriver();
        private WebElement loginFiled = driver.findElement(By.id("textfield-1015-inputEl"));
        private WebElement passwordField = driver.findElement(By.id("textfield-1017-inputEl"));
        private WebElement signButton = driver.findElement(By.id("button-1021-btnIconEl"));
    /*
        @FindBy(xpath = "//*[@id=\"textfield-1015-inputEl\"]")
        private WebElement loginFiled;
     
        @FindBy(xpath = "//*[@id=\"textfield-1017-inputEl\"]")
        private WebElement passwordField;
     
        @FindBy(xpath = "//*[@id=\"button-1021-btnIconEl\"]")
        private WebElement signButton;
    */
        public LoginPage(WebDriver driver) {
            this.driver=driver;
     
           // PageFactory.initElements(driver, this);
        }
     
        public void singIntoSystemAsUser(String login,String password) {
                loginFiled.sendKeys(login);
                passwordField.sendKeys(password);
                signButton.click();
        }
    }
    Exception is
    org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"#textfield\-1015\-inputEl"}
    Last edited by KirPochta; December 8th, 2021 at 12:38 PM.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: The element does not have time to load on the page

    Is this a standalone program that can be compiled and executed without any other software?
    How can the code be compiled and executed for testing?
    It does not have any import statements needed for compile.
    How is the code executed?
    Does it use a command line to start execution?
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Dec 2021
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: The element does not have time to load on the page

    I removed the import so that they do not interfere with the eyes.
    package test;
     
    import org.junit.After;
    import org.junit.Assert;
    import org.junit.Before;
    import org.junit.Test;
    import org.openqa.selenium.*;
    import org.openqa.selenium.chrome.ChromeDriver;
    import org.openqa.selenium.chrome.ChromeOptions;
    import org.openqa.selenium.support.ui.ExpectedConditions;
    import org.openqa.selenium.support.ui.WebDriverWait;
    import org.testng.annotations.*;
    import pages.HomePage;
    import pages.LoginPage;
    import java.util.concurrent.TimeUnit;
     
     
    public class HelloWebDriver {
     
        private WebDriver driver;
        private ChromeOptions options;
        private LoginPage loginPageObj;
        private HomePage homePage;
        private WebDriverWait wait;
     
        @Before
        public void browserSetup() {
            System.out.println("aaa");
            options = new ChromeOptions();
            options.setPageLoadStrategy(PageLoadStrategy.NONE);
            options.addArguments("start-maximized");
            options.addArguments("disable-infobars");
            driver = new ChromeDriver(options);
            driver.manage().timeouts().implicitlyWait(5000,
                    TimeUnit.MILLISECONDS);
            driver.manage().timeouts().pageLoadTimeout(5000,
                    TimeUnit.MILLISECONDS);
            driver.manage().timeouts().setScriptTimeout(5000,
                    TimeUnit.MILLISECONDS);
            driver.manage().timeouts().implicitlyWait(50, TimeUnit.SECONDS);
     
            System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
            driver.get("https://junior.webquik.ru/");
            wait = new WebDriverWait(driver,10);
        }
        @org.junit.Test
        public  void signIntoSystem() throws InterruptedException {
     
            wait.until(ExpectedConditions.presenceOfElementLocated
                    (By.id("textfield-1015-inputEl")));
            wait.until(ExpectedConditions.presenceOfElementLocated
                    (By.id("textfield-1017-inputEl")));
            wait.until(ExpectedConditions.presenceOfElementLocated
                    (By.id("button-1021-btnIconEl")));
            loginPageObj = new LoginPage(driver);
     
            loginPageObj.singIntoSystemAsUser("U0191767","06258");
            Assert.assertEquals(driver.getTitle(),"webQUIK 7.6.2");
        }
     
        @org.junit.Test
        public  void createNewTicketWithLimits() throws InterruptedException {
            wait.until(ExpectedConditions.presenceOfElementLocated
                    (By.xpath("//*[@id=\"textfield-1015-inputEl\"]")));
            wait.until(ExpectedConditions.presenceOfElementLocated
                    (By.xpath("//*[@id=\"textfield-1017-inputEl\"]")));
            wait.until(ExpectedConditions.presenceOfElementLocated
                    (By.xpath("//*[@id=\"button-1021-btnIconEl\"]")));
            loginPageObj = new LoginPage(driver);
            loginPageObj.singIntoSystemAsUser("U0191767","06258");
     
            Thread.sleep(5000);
            Assert.assertEquals(driver.getTitle(),"webQUIK 7.6.2");
     
            homePage.createNewTicketWithlimits("CNYRUB_SPT","5","1");
        }
        @Test
        public  void createNewTicketWithMarketablePrice() throws InterruptedException {
            Thread.sleep(5000);
            loginPageObj.singIntoSystemAsUser("U0191767","06258");
     
            Thread.sleep(5000);
            Assert.assertEquals(driver.getTitle(),"webQUIK 7.6.2");
     
            homePage.createNewTicketWithMarket("CHMF","5");
        }
        @After
        public void closeBrowser() {
            driver.quit();
            driver = null;
        }
    }
    package pages;
     
    import org.openqa.selenium.By;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.WebElement;
    import org.openqa.selenium.chrome.ChromeDriver;
    import org.openqa.selenium.support.FindBy;
    import org.openqa.selenium.support.PageFactory;
    import org.openqa.selenium.support.ui.ExpectedConditions;
    import org.openqa.selenium.support.ui.WebDriverWait;
     
    public class LoginPage {
        private WebDriver driver = new ChromeDriver();
        private WebElement loginFiled = driver.findElement(By.id("textfield-1015-inputEl"));
        private WebElement passwordField = driver.findElement(By.id("textfield-1017-inputEl"));
        private WebElement signButton = driver.findElement(By.id("button-1021-btnIconEl"));
    /*
        @FindBy(xpath = "//*[@id=\"textfield-1015-inputEl\"]")
        private WebElement loginFiled;
     
        @FindBy(xpath = "//*[@id=\"textfield-1017-inputEl\"]")
        private WebElement passwordField;
     
        @FindBy(xpath = "//*[@id=\"button-1021-btnIconEl\"]")
        private WebElement signButton;
    */
        public LoginPage(WebDriver driver) {
            this.driver=driver;
     
           // PageFactory.initElements(driver, this);
        }
     
        public void singIntoSystemAsUser(String login,String password) {
                loginFiled.sendKeys(login);
                passwordField.sendKeys(password);
                signButton.click();
        }
    }

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: The element does not have time to load on the page

    The code won't compile because of missing classes.
    What jar files are needed to compile the code?

    What about these questions?
    Is this a standalone program that can be compiled and executed without any other software?
    How can the code be compiled and executed for testing?

    How is the code executed?
    Does it use a command line to start execution?
    If you don't understand my answer, don't ignore it, ask a question.

  7. #7
    Junior Member
    Join Date
    Dec 2021
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: The element does not have time to load on the page

    you need a development environment to run this code, for example initial idea
    better of all u can dawnload my project from github

    https://github.com/KirillPochta/TestNWebDriver.git

  8. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: The element does not have time to load on the page

    you need a development environment
    Sorry, I do not have any environment to run your code.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. opening a new page and running a script on it, from the old page.
    By Hudsense in forum What's Wrong With My Code?
    Replies: 0
    Last Post: September 25th, 2014, 03:51 AM
  2. Replies: 6
    Last Post: August 4th, 2014, 05:04 AM
  3. Replies: 0
    Last Post: September 7th, 2013, 06:09 AM
  4. how can we load css file without pressing refresh button in web page
    By rajabetha in forum Other Programming Languages
    Replies: 1
    Last Post: May 15th, 2013, 07:30 PM
  5. Pop up window - which is going to load when my index page is loading
    By dimincheva in forum Other Programming Languages
    Replies: 1
    Last Post: December 20th, 2012, 10:20 AM

Tags for this Thread