Jacobvu84 / selenium-vietnam-training-course

Questions Tracking
7 stars 5 forks source link

Use id or name attribute of web element as a WebElement object #60

Open Jacobvu84 opened 5 years ago

Jacobvu84 commented 5 years ago
<input name='username' ...>

If you have a web element that contains id or name attribute so you can use this attribute as a WebElement object

Normally,

@FindBy(id='username')
WebElement userNamField;

userNamField.SendKeys("jacob.vu");

For Serenity BDD Test Framework. That is simple

WebElementFacade username;

username.type("jacob.vu");
Jacobvu84 commented 5 years ago

In case,

<input name='user-name' ...>

We are not able to use user-name as WebElement because the value of name attribute is not like a variable in programming language