How To Write Code in Selenium To Click This Picture , Down I Have Attached My Selenium Code.

package Login;

import java.io.File;
import java.io.IOException;

import org.apache.poi.EncryptedDocumentException;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.AfterMethod;

public class Signup {
    WebDriver driver;
      public void beforeMethod() 
          System.setProperty("webdriver.chrome.driver", "F:\\New folder\\chromedriver.exe");
           driver = new ChromeDriver();
  public void f() 


  public void afterMethod() throws EncryptedDocumentException, InvalidFormatException, IOException 
      String un = Signup.Getdata(1, 0);


      String em= Signup.Getdata(1, 1);


      String ps = Signup.Getdata(1, 2);


      String pho = Signup.Getdata(1, 3);


      String age = Signup.Getdata(1, 4);


      String city = Signup.Getdata(1, 5);


     WebElement e1 = driver.findElement(By.xpath("/html[1]/body[1]/div[2]/div[3]/div[1]/ss-auth-form[1]/md-card[1]/ss-signup-form[1]/div[1]/form[1]/div[6]"));
     Actions a1 = new Actions(driver);
     catch(Exception e)
         System.out.println("The Button can't Be Clicked!!");
     // driver.findElement(By.xpath("//ss-submit-button[@label='Sign Up']//input[@class='submit']")).click();


  public static String Getdata(int r, int c) throws EncryptedDocumentException, InvalidFormatException, IOException
      File targetfile = new File("F:\\Test","Book2.xlsx");  

      Workbook wb = WorkbookFactory.create(targetfile);

        String s1 = wb.getSheet("Test1").getRow(r).getCell(c).getStringCellValue();

        return s1;


Image Reference

  • checkout here sqa.stackexchange.com/questions/17022/… you will get some idea Jun 18, 2018 at 9:48
  • @koushick you may want to remove the IP address and port of your testing website from Stack Exchange
    – Aaron F
    Jun 18, 2018 at 14:14
  • @AaronF What are You Trying To Say, Can't Get it Man?
    – koushick
    Jun 20, 2018 at 6:45
  • @AaronF Yay! Man i Get it. You are Saying About My Testing Ip Adress. Okay Fine Man. Thanks.
    – koushick
    Jun 20, 2018 at 6:47

3 Answers 3


There is not any way to automate captcha submission. Actually, that's the reason captcha is used for. All you can do are:

  • ReCAPTCHA's documentation provides a set of keys that you can use for testing. You can also whitelist your testing domains for exclusion.

  • Run your tests on a development or staging environment and disable the CAPTCHA in that environment.

  • In your test, submit the form without submitting the CAPTCHA and then check for the CAPTCHA error. Expectedly you won't be able to successfully submit the form this way, but you'll be able to test whether it's validating properly or not.


Selenium can't handle CAPTCHA.

CAPTCHA, an acronym for "Completely Automated Turing Test to tell Computers and Humans Apart". It is to determine whether or not the user is a human. If you can simply automate a Captcha using Selenium, then the main purpose of Captcha becomes useless.


  1. How-to-handle-captcha-using-selenium-web-driver

You can bypass ReCAPTCHA, but you won't be testing the box itself - this basically enables you to switch it off in your test environment.

Check out Google Developer's FAQ page here:

I'd like to run automated tests with reCAPTCHA v2. What should I do?

With the following test keys, you will always get No CAPTCHA and all verification requests will pass.


Secret key: 6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe

Your Answer

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

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