RE: Locating Button


I have a button with the following code:

<input class=”btn” id=”mypage:formid:relatedScenaiosListId:j_id27:j_id28″ name=”mypage:formid:relatedScenaiosListId:j_id27:j_id28″ onclick=”‘/apex/newscenario?Opportunity__c=006f00000072n8hAAA’,’_top’, 1);;A4J.AJAX.Submit(‘mypage:formid’,event,{‘similarityGroupingId’:’mypage:formid:relatedScenaiosListId:j_id27:j_id28′,’parameters’:{‘mypage:formid:relatedScenaiosListId:j_id27:j_id28′:’mypage:formid:relatedScenaiosListId:j_id27:j_id28’} } );return false;” value=”New” type=”button”>

I’ve tried xpath but that doesn’t seem to work either.

WebElement txtnew = driver.findElement(By.xpath(“//input[@value=’New’][@type=’button’]”));;

hi richard
Did You Checked It on Firepath for Its occurances..?

on August 28, 2014.
Add Comment
4 Answers

You can use xpather, firebug or fire path to to locate any element
before locating you can confirm that  is the element is generating dynamic ids
you can also use relative or absolute xpath of the element
suppose if two elements has same id name then selenium will locate the first element by default.
this info will help you to locate the button

Doctor Answered on September 1, 2014.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.