RE: Locating Button

Answered

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=”window.open(‘/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’]”));

txtnew.click();

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

on August 28, 2014.
Add Comment
4 Answers

HI Richard
May be You Have Some Elements(hidden elements)   With The Same Xpath and Selenium is Trying to Click on Them
I Would Suggest You to go With Firepath as it Will find all the Occurances For You and You Can Select Your Element

here is an Example on that

RE: Locating Button

In This Case One Of Element is Visible While Other is Hidden
i hope This Thing is Clear to You

thanks
ankit

Vice Professor Answered on September 1, 2014.
Add Comment

Your Answer

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