1

My code is as below :

package pages;

import java.util.concurrent.TimeUnit;

import org.junit.Test;
import org.openqa.selenium.chrome.*;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.junit.Assert;

public class Google{

    public static void main(String args[]){

        System.setProperty("webdriver.chrome.driver", "D:\\Drivers\\chromedriver.exe");
        WebDriver driver = new ChromeDriver();

        driver.get("https://www.google.com");
        driver.findElement(By.id("lst-ib")).sendKeys("Concerto");
        driver.findElement(By.id("_fZl")).click();
        //driver.findElement(By.linkText("Welcome to Concerto Software & Systems Pvt Ltd")).click();
        String linkname = null; 
        Boolean contains = driver.getPageSource().contains("//*[@id='rso']/div[2]/div/div[3]/div/h3/a");
        System.out.println(contains);
        driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
        driver.findElement(By.linkText("Welcome to concerto Software & Systems Pvt Ltd")).click();  
    }
}
  • And your question is? If you are getting an error please supply the error. What have you tried? If you except a step to work, but it isnt please specify. – Niels van Reijmersdal Feb 7 '17 at 10:36