简体   繁体   中英

various ways to find elements by using Webdriver @FindBy annotations

I am trying to find the solution for my Webdriver script to work. I need your help to find the solution in my scenario.

I have a web application that creates form by using tabbed screen. There is a Next and Back buttons that have similar attributes and I cant find the solution.

xpath doesn't work, CSS has the same name and its getting confused.

here is the "Next" button that needs to be clicked:

 <div class="button" style="margin-right: 5px;"> <input type="button" onclick="javascript:submitForm('metaStudyAction!moveToData.action')" value="Next"> 

I would like to use @FindBy annotation to find the element. Can I use HOW with multiple attributes?

You can use css for multiple attributes

@FindBy(css = "[type='button'][value='Next']")
private WebElement button;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM