How to use the DOM locators in Selenium
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开发者_如何学编程?
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.
or with css:
css=input[type=image], [src="/images/Login_submit.gif"]
Have you tried
//input[@src='/images/Login_submit.gif']
Try this locator:
//input[contains(@src, 'Login_submit.gif')].
精彩评论