Unable to click on Image button in selenium Webdriver

3,678 views
Skip to first unread message

Jegadeesh mani

unread,
Feb 24, 2015, 1:49:37 AM2/24/15
to seleniu...@googlegroups.com
Hi Team,

Kindly Help me out, How to do click on image button in selenium ? 

Thanks,
Jegadeesh

Mukesh otwani

unread,
Feb 25, 2015, 12:58:16 PM2/25/15
to seleniu...@googlegroups.com
Hi Jegadeesh,


You can use simple click for this, just find the xpath of image button and click

for Sample codes refer

www.learn-automation.com

Jegadeesh mani

unread,
Mar 7, 2015, 11:24:41 PM3/7/15
to seleniu...@googlegroups.com

Hi Mukesh,

See the below code, I have used only xpath, but i was unable to click the image button.

                    driver.findElement(By.xpath("//a[starts-with(@href, '../images/submit.png')]")).click();
Here i have attached the code. Kindly help me out or give me a sample code.
Screenshot_2.png

alagar...@gmail.com

unread,
Mar 8, 2015, 10:58:54 PM3/8/15
to seleniu...@googlegroups.com
Hello Mukesh,

The Xpath seems to be not correct. The property name should be 'src' rather than 'href' and looking at your code screenshot I noticed your element type is not link.(<a> </a>. I could provide more data if you could let me know the link of the website and the button name to be clicked.

Regards,
Ganesh

Jegadeesh mani

unread,
May 4, 2015, 1:22:05 AM5/4/15
to seleniu...@googlegroups.com
Dear Mukesh,

perform scripts below sample scripts like that.

driver.findElement(By.xpath("//img[@src='../images/submit.png']")).click();

Thanks,
Jegadeesh

Chirag Khimani

unread,
May 4, 2015, 3:10:08 AM5/4/15
to seleniu...@googlegroups.com
 Hi Jegadeesh,

 Have you resolved your problem or it is still there?

 Thanks
 Chirag


On Tuesday, February 24, 2015 at 12:19:37 PM UTC+5:30, Jegadeesh mani wrote:

Jegadeesh mani

unread,
May 4, 2015, 3:20:47 AM5/4/15
to seleniu...@googlegroups.com
Thanks for your reply, Issues has been resolved. But I have existing one more issues . I was unable to pass the message in the text field, Kindly help me out. See the screen shot below.




Inline image 1

Thanks,
Jegadeesh

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/2441562e-4070-41b8-9e27-7af50e926004%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gopa Kishore Mindi

unread,
May 4, 2015, 3:29:52 AM5/4/15
to seleniu...@googlegroups.com
Hi Jegadeesh,

Can you please post the code that you are using to input into the message box, It should be the locator issue.

Thanks,

Gopa.

Jegadeesh mani

unread,
May 4, 2015, 4:35:01 AM5/4/15
to seleniu...@googlegroups.com
Hi kishore,


See the code : driver.findElement(By.id(".//*[@id='messagearea']")).sendKeys("Sending message");

Thanks,
Jegadeesh

Gopa Kishore Mindi

unread,
May 4, 2015, 6:53:48 AM5/4/15
to seleniu...@googlegroups.com
Hi Jegadeesh,

You are trying to click using id as the locator but actually trying to find element using xpath. Use the below code and it should work:

driver.findElement(By.id("messagearea")).sendKeys("Sending message");

Thanks,

Gopa.

Jegadeesh mani

unread,
May 4, 2015, 8:31:50 AM5/4/15
to seleniu...@googlegroups.com
Dear Kishore,

As per your instruction, I was performed the task but it was useless. Behaving of this issues is still facing it has same. Please let me know if any details required to resolve this issues.

Steps:
=====
1. Starting the application
2. Entering the user name and password
3. Navigating to Particular page
4. In the page will have separate two frames.
5. In the middle of the page will have the text field once navigated unable to move the search the text field, to pass the instructions.

Thanks,
Jegadeesh


Gopa Kishore Mindi

unread,
May 4, 2015, 9:03:32 AM5/4/15
to seleniu...@googlegroups.com
Hi Jegadeesh,

Unless you post the code that you are using , it will be difficult to solve the issues.

Jegadeesh mani

unread,
May 4, 2015, 9:27:49 AM5/4/15
to seleniu...@googlegroups.com
Dear Kishore,

See the code in the below mail and attached screen shot also.

methods were calling in Main, It is available in another class file.



package Sample;

import org.apache.log4j.Logger;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;


public class Bulletinboard {
   

    static Logger log = Logger.getLogger(Catie_auto.class);
    public void navigating_page(WebDriver driver){
               
        // Click on application admin
            driver.findElement(By.xpath(".//*[@id='menu']/table/tbody/tr/td[2]/ul/li[3]/a/span")).click();
           
        //Click on Bulletin in the list of application admin
            driver.findElement(By.xpath(".//*[@id='menuDetails4']/ul/li[1]/a/span")).click();
           
           
        // Navigated to Bulletin board
            log.info("Navigated to Bulletin board");
        }
       
        public void send_msg(WebDriver driver) throws InterruptedException{

           
           
            driver.findElement(By.id("messagearea")).sendKeys("Sending message");
           
            log.info("Message send successfully");
           
        }


Inline image 1


Anand Somani

unread,
May 4, 2015, 11:52:24 AM5/4/15
to seleniu...@googlegroups.com
package Sample;

import org.apache.log4j.Logger;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.
WebElement;


public class Bulletinboard {
   

    static Logger log = Logger.getLogger(Catie_auto.class);
    public void navigating_page(WebDriver driver){
               
        // Click on application admin
            driver.findElement(By.xpath("//*[@id='menu']/table/tbody/tr/td[2]/ul/li[3]/a/span")).click();

           
        //Click on Bulletin in the list of application admin
            driver.findElement(By.xpath("//*[@id='menuDetails4']/ul/li[1]/a/span")).click();

For more options, visit https://groups.google.com/d/optout.



--
~ Anand Somani

CH!NN@ K

unread,
May 5, 2015, 2:43:31 AM5/5/15
to seleniu...@googlegroups.com
Hi Jegadeesh

I have solution for your issue. I think it may help you..Please refer this link :
http://www.techlearn.in/content/how-create-log-file-using-log4j-seleniumwebdriver-java

---
Thanks & Regards,
Purushotham Karimbedu,
Drupal Developer and QA Engineer,
Website for Selenium : http://techlearn.in


Jegadeesh mani

unread,
May 5, 2015, 4:31:28 AM5/5/15
to seleniu...@googlegroups.com
Hi Chinna,

I was fed up, try a lot of scenarios unable to resolve it this issues. please anybody help me.

Thanks,
Jegadeesh

Mercious

unread,
May 5, 2015, 4:49:24 AM5/5/15
to seleniu...@googlegroups.com
What is the error message? Unable to find element or what exactly does it say? 

Jegadeesh mani

unread,
May 5, 2015, 4:58:38 AM5/5/15
to seleniu...@googlegroups.com
unable to find element.

thanks
jegadeesh

On Tue, May 5, 2015 at 2:19 PM, Mercious <hart...@gmx.de> wrote:
What is the error message? Unable to find element or what exactly does it say? 

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.

murali seleniumtrainer

unread,
May 5, 2015, 5:08:22 AM5/5/15
to seleniu...@googlegroups.com
Hi,

I am just confused, as some where you said its solved and asked for another issue..but now saying again not able to click on that image as you  said first right?

can you paste that DOM completely instead of that img tag line so that different ways to get that element will be suggested..

Thank You
Murali

Mercious

unread,
May 5, 2015, 5:09:07 AM5/5/15
to seleniu...@googlegroups.com
Unfortunately your screenshot is very small so i can barely see. 

You have to assure:
a) Your driver has navigated to the correct page
b) This page contains the element you are looking for
c) The way you are looking for it is correct (Make sure the id is correct and never changes for some reason)
d) Make sure the element is REALLY in the page and not inside of an iframe or something

Is it possible to provide a minimal version of the website containing the button? 

Pratiksha Budhwant

unread,
Sep 30, 2019, 2:12:53 PM9/30/19
to Selenium Users
@Jegadeesh, how did you resolve the original issue posted on this chat? the "unable to click Image button in selenium webdriver" ? I am facing a similar issue. 


On Monday, 4 May 2015 08:20:47 UTC+1, Jegadeesh mani wrote:
Thanks for your reply, Issues has been resolved. But I have existing one more issues . I was unable to pass the message in the text field, Kindly help me out. See the screen shot below.




Inline image 1

Thanks,
Jegadeesh
On Mon, May 4, 2015 at 12:40 PM, Chirag Khimani <khiman...@gmail.com> wrote:
 Hi Jegadeesh,

 Have you resolved your problem or it is still there?

 Thanks
 Chirag

On Tuesday, February 24, 2015 at 12:19:37 PM UTC+5:30, Jegadeesh mani wrote:
Hi Team,

Kindly Help me out, How to do click on image button in selenium ? 

Thanks,
Jegadeesh

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to seleniu...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages