mercredi 2 janvier 2019

want to test the ebay site login.with out Xpath

I want to test the ebay site login.with out Xpath. but it is not working I tried so many hours . please explain me the error.
1. Open Google website 2. Search for “ebay” website 3. Click on the appropriate result 4. Go to http://www.ebay.com website 5. Click on the “Sign in” link to navigate to the ebay login page 6. Enter email address/password 7. Click on Sign In button 8. Verify your user name.

 package Script;

    import org.openqa.selenium.By;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.firefox.FirefoxDriver;
    import org.testng.annotations.Test;

    public class TestEbay_login {
        @Test
        public void ebay_login() throws InterruptedException {

                System.setProperty("webdriver.gecko.driver", "C:\\Users\\Senani\\Downloads\\Programs\\geckodriver-v0.23.0-win64\\geckodriver.exe");
                WebDriver driver = new  FirefoxDriver();
                //driver.get("https://www.google.com");
                driver.navigate().to("https://www.google.com");
                driver.manage().window().maximize();
                driver.findElement(By.name("q")).sendKeys("ebay");
                driver.findElement(By.name("btnK")).submit();
                driver.findElement(By.cssSelector("a[href='www.ebay.com']")).click();
                driver.findElement(By.linkText("Sign in")).click();
                driver.findElement(By.id("userid")).sendKeys("tgpsenani");
                driver.findElement(By.id("pass")).sendKeys("tgpsenani19");

                driver.findElement(By.id("sgnBt")).click();


        }

    }

FAILED: ebay_login org.openqa.selenium.NoSuchElementException: Unable to locate element: a[href='www.ebay.com'] For documentation on this error, please visit: https://www.seleniumhq.org/exceptions/no_such_element.html Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'




Aucun commentaire:

Enregistrer un commentaire