Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Protractor: find hidden input element by attribute value

Tags:

protractor

How do I go about locating & getting a value for an element like the following?

<input type="hidden" title="username" value="joe.doe">

Any suggestions much appreciated.

like image 803
Iladarsda Avatar asked Nov 28 '14 16:11

Iladarsda


1 Answers

var userNameElm = $('input[title=username]');

it('is present but invisible', function() {
    expect(userNameElm.isPresent()).toBeTruthy();
    expect(userNameElm.isDisplayed()).toBeFalsy();
});

it('should have proper value attribute', function() {
    expect(userNameElm.getAttribute('value')).toEqual('joe.doe');
});
like image 176
Leo Gallucci Avatar answered Oct 16 '22 02:10

Leo Gallucci