Cant sendKeys into ebay username field using WebDriver Selenium 3 with Java and chrome

I have been unable to sendKeys text into the username and password field on ebay.

Here is the code:

    WebDriver driver = null;
    System.setProperty("webdriver.chrome.driver", "/usr/local/bin/chromedriver");
    driver = new ChromeDriver();
    driver.get("http://www.ebay.co.uk");

    WebElement myEbay = driver.findElement(By.linkText("My eBay"));
    myEbay.click();

    WebElement signInForm = driver.findElement(By.id("SignInForm"));

    if (signInForm.isDisplayed())
        System.out.println("Sign in form is displayed");

    WebElement username;

    username = driver.findElement(By.cssSelector("input[placeholder="Email or username"]"));

It manages to find the My Ebay link, and verifies that the sign in form exists but the the username and password fields id’s change after every refresh of the page.

The username cssSelector seems to be the problem??

Miner Asked on July 1, 2017 in General Stack.
Add Comment


  • LATEST ANSWERS

  • 1 Answer(s)
    Best answer

    This generally looks like a visual testing task. Are you limited to Selenium only? In case there is an option for you to try something else for this task, you could do that with a visual regression testing tool. Such as Screenster which is actually an alternative to Selenium for visual/CSS testing tasks.

     

    Screenster is a test automation tool which performs screenshot-based comparison of different versions of your web pages. First it creates a visual baseline for a page, taking a screenshot for each user action. During the next run it takes a new screenshot at each step, compares it with the one from baseline and highlights differences. It also has a number of features for easy maintenance of tests: here is how it handles regression testing of Gmail UI.

     

    Default Answered on July 3, 2017.
    Add Comment

    Write your answer

    By posting your answer, you agree to the privacy policy and terms of service.