tags:

views:

707

answers:

3

Hi,

I've the HTML source like this,

<input type="image" onclick="return logSub();" src="/images/Login_submit.gif" width="105" height="33" border="0" />

Here there is no ID or NAME. So I can only locate this using image index (which is hard) or using the src tag? But I dont know how use the src tag?

Is that possible?

+1  A: 

Have you tried

//input[@src='/images/Login_submit.gif']
Jansen Price
+1  A: 

See my answer to a previous question here: http://stackoverflow.com/questions/2007367/selenium-is-it-possible-to-use-the-regexp-in-selenium-locators/2007531#2007531

Basically the dom= protocol allows you to use javascript to locate elements for Selenium.

slebetman
+1  A: 

or with css:

css=input[type=image], [src="/images/Login_submit.gif"]

Rodreegez
Thanks for the hint. I want to do like this,selenium.click("dom=document.getElementsByTagName('input')('src=/images/Login_submitBut.gif')");I think, only using image is the option in selenium. This works,selenium.click("dom=document.getElementsByTagName('input')(1)");
Rajasankar