0

I'm just doing some test automation of web UI, specifically this page https://autorefi.capitalone.com/login/

I am locating the lastname, zipcode, ssn input boxes and typing in data (the data here doesn't matter). I am then simply using the locator to click the "Sign In" button. The problem is, everytime I run this within my code (Java) using selenium/chromedriver, I get an error

Sorry, we weren't able to log you in. If you continue to see this error, make sure you're using one of our supported browsers.

enter image description here

The problem is this is not the correct error message. You can try this yourself by simply opening another tab and entering a random lastname, zipcode, and last 4 digit of SSN. Conversely, if you actually had an offer with Capital one, it would bring up a different page completely. The point is, the first error message I posted only comes via selenium and is not correct. The correct error message is:

Sorry, it looks like you don't have an offer with Capital one.

enter image description here

I tried sleeping the thread before clicking the button ,because I thought it was maybe clicking it too fast, but it still didn't work. I a bit perplexed why doing the same set of operations manually seems to work, but launching this programmatically through selenium. Can anyone provide any insight here? My code is:

 WebElement element;
        WebDriver driver = null;
        ChromeOptions options = new ChromeOptions();
        options.setPageLoadStrategy(PageLoadStrategy.NONE);
        driver = new ChromeDriver(options);
        WebDriverManager.getInstance(CHROME).setup();

        // TODO: PROD
        driver.get("https://autorefi.capitalone.com/login/");

        WebElement refiCommonLoginForm = new WebDriverWait(driver,10).until(ExpectedConditions.presenceOfElementLocated(By.tagName("refi-common-login-form")));
        WebElement shadowRoot1 = expandRootElement(refiCommonLoginForm, driver);

        WebElement refiCommonLastName = shadowRoot1.findElement(By.tagName("refi-common-last-name"));
        WebElement refiCommonLastNameShadowRoot = expandRootElement(refiCommonLastName, driver);

        WebElement refiCommonZip = shadowRoot1.findElement(By.tagName("refi-common-zip"));
        WebElement refiCommonZipShadowRoot = expandRootElement(refiCommonZip, driver);

        WebElement refiCommonLastFourSSN = shadowRoot1.findElement(By.tagName("refi-common-last-four-ssn"));
        WebElement refiCommonLastFourSSNShadowRoot = expandRootElement(refiCommonLastFourSSN, driver);


        refiCommonLastNameShadowRoot.findElement(By.id("loginLastName")).sendKeys("random last name");
        refiCommonZipShadowRoot.findElement(By.id("loginZipCode")).sendKeys("43978");
        refiCommonLastFourSSNShadowRoot.findElement(By.id("loginLastFourSSN")).sendKeys("3483");
        Thread.sleep(2000);
        shadowRoot1.findElement(By.tagName("button")).click();

1 Answer 1

1

Absolutely not sure the issue is that, but still possibly this will help.
Instead of clicking the "Sign in" button try submitting it i.e. shadowRoot1.findElement(By.tagName("button")).submit()
But I guess the issue here is that this site has some kind of anti bot defense that blocks automated access to it.

Sign up to request clarification or add additional context in comments.

2 Comments

Yeah doesn't look like submit() worked. This is really frustrating , like Selenium exists to automate UI but the pages can block automated access? So annoying
Yup, there are several technologies developed and used in the last period to prevent bot usages. Google and many others are working on this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.