Thursday, 15 August 2013

java - How to record a click event for an image acting as a button in Selenium? -


In my application, I got a button in the form of a button. When I record button click event in Selenium IDE and run it again, I only run it back, but click event is not actually submitting values ​​

Ex: submit button ( Which is an image) must actually be submitted for the database value but when I check in the database, the value is not added to it

element value

  & lt; Input Width = "98" vspace = "3" type = "image" height = "15" border = "0" id = "image 1" src = "image / butt_submit.gif" value = "submit" name = " Submit "& gt;   

selenium code

  selenium Click ("// input [@ id = 'Image1'] "); Selenium.waitForPageToLoad ("30000");   

Please help

thank you!

HG

The issue is not with the click on the Selenium / IDE image The code you are using (in HTML) will not submit form data, even if you did it manually. Have you checked in earlier?

However, if you want to use image as submitted submit for a form, onclick Event to submit the form for the image. See for form.submit :

  & lt; Html & gt; & Lt; Top & gt; & Lt; Script & gt; Function form submission () {document.getElementById ("frm1"). Submit (); } & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Form id = "frm1" action = "form_action.asp" & gt; First name: & lt; Input type = "text" name = "fname" & gt; & Lt; Br> Last name: & lt; Input type = "text" name = "lname" & gt; & Lt; Br> & Lt; Input type = "button" onclick = "formSubmit ()" value = "submit form" & gt; & Lt; / Form & gt; & Lt; / Body & gt; & Lt; / Html & gt;   

They are using a button here but you can use it for your image.

More about HTML form basics:

No comments:

Post a Comment