1

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?

Rajasankar
  • 928
  • 1
  • 19
  • 41

4 Answers4

2

See my answer to a previous question here: selenium: Is it possible to use the regexp in selenium locators

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

Community
  • 1
  • 1
slebetman
  • 109,858
  • 19
  • 140
  • 171
1

Try this locator:

//input[contains(@src, 'Login_submit.gif')]. 
ЯegDwight
  • 24,821
  • 10
  • 45
  • 52
1

Have you tried

//input[@src='/images/Login_submit.gif']
Jansen Price
  • 2,452
  • 1
  • 14
  • 5
1

or with css:

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

Rodreegez
  • 576
  • 5
  • 15
  • 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 Jan 30 '10 at 15:31