2016-06-15 6 views
1

からロードされた要素は、だから私は、この「レビュー協定」ボタンをヒットしようとしている見つけることができませんセレンは埋め込まれたHTML

<section class="col-33 text-right"> 
     <button class="anchor-button bordered" ng-click="onClickReviewAgreement()">Review Agreement</button> 
</section> 

BUT明らかに別のリソースからロードされているので、findElement(By.*)は動作しません - 私もBy.xpath("/html/body/ul/li[2]/notification-bar/ul/li/section[1]/section[2]/button")を試しました - 。私はView Page Sourcesに取得していますすべての関連するコードは次のとおりです。

<!-- Agreement form modal --> 
    <ui-modal 
     ui-modal-id="ui.modals.agreementFormModal" 
     ui-modal-class="takeover agreement" 
     ui-modal-controller="AgreementFormController" 
     ui-modal-template-url="paths.templates + '/components/forms/tpl.agreement-form.html'" 
     ui-modal-has-dimmer="true"> 
    </ui-modal> 

は、私は要素のこれらの種類を選択することができます方法はありますか?

答えて

3

あなたは、CSSを使用してng-click="onClickReviewAgreement()"に特異的に結合することができるはずです。これはユニークでなければならず、CSSはxpathのより優れた効率的な代替手段です

2

は、要素を見つけ、その後、クリックしてCSSを使用してみてください -

WebElement buttonElement = driver.findElement(By.cssSelector('[ng-click="onClickReviewAgreement()"]')); 
buttonElement.click(); 
関連する問題