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
Best answer

So I missed an important piece of information.  I downloaded Selenium IDE and saw the control was in a different frame:

So the answer was:


driver.manage().timeouts().implicitlyWait(25, TimeUnit.SECONDS);

driver.switchTo().frame("066i0000004bNpx");

WebElement txtNewbtn = driver.findElement(By.id("mypage:formid:relatedScenaiosListId:j_id27:j_id28")); txtNewbtn.click();

Train Answered on October 14, 2014.
Add Comment

Your Answer

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