Skip to content

Commit

Permalink
Update Fill in value for input type text by its Label #146
Browse files Browse the repository at this point in the history
  • Loading branch information
TasneemNatshah committed Jul 13, 2024
1 parent 159fa19 commit 0ccab0d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/step-definitions/webship.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,15 @@ When(/^(I|we)* fill in "([^"]*)?" with: by( its)*( "([^"]*)?")* (attribute|attr)
});

/**
* Fills in form field with specified element
* Example: And I fill in "webshipco" for "username"
* Fill in value for input type text by its Label
* Example: When I fill in "webshipco" for "Username"
*
*/
When(/^(I|we)* fill in "([^"]*)?" for "([^"]*)?"$/, function (pronoundCase, value, field) {
browser.setValue(field, value);
const elementField = browser.element.findByText(field);
browser.getAttribute(elementField, 'for', function (eleAttribute) {
return browser.setValue('#' + eleAttribute.value, value);
});
});

/**
Expand Down

0 comments on commit 0ccab0d

Please sign in to comment.