re: Locate element by classname

10 views
Skip to first unread message

timothy ma

unread,
Oct 18, 2017, 2:18:30 AM10/18/17
to Selenium Users
hi

I have a button 

<input type="submit" name="btnAddnew" value="add new" id="btnAddnew" tabindex="3" class="add" style="height:21px;width:180px;">

Because the tool for developing the application will give different name and id so I try to locate it by class:

d.findElement(By.className("add"))

and

@FindBy(className="add") private WebElement addNew;

Both way I still cannot identify the button as Webelment.

Please kindly help.

Thanks
Reply all
Reply to author
Forward
0 new messages