0

I am writing selenium program to Login to Gmail account.I have given username through source code and further step is click Next button.

package com.core.selenium;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class Gmaildemo {
    public static void main(String args[]) {
        System.setProperty("webdriver.chrome.driver", "D:\\REKHA\\SOFTWARES\\chromedriver.exe");
        WebDriver driver = new ChromeDriver();
        driver.get("http://www.gmail.com");
        driver.findElement(By.name("identifier")).sendKeys("[email protected]");
        driver.findElement(By.className("RveJvd snByac")).click();
    }

}

Getting below error.

Exception in thread "main" org.openqa.selenium.InvalidSelectorException: invalid selector: Compound class names not permitted

Getting below error.It is not able to recongnise Next button.

1 Answer 1

0

You are trying to click the <span> element, which is wrong. The span doesn't have the click functionality. aim for the div element with id identifierNext. try this: driver.findElement(By.id("identifierNext")).click();

Selenium doesn't allow compund class names in By.className. Even if it did, that particular name, "RveJvd snByac", is not unique on the webpage and may yield different result than expected.

0

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.