Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

get attribute

const assert = require('assert')

describe('v5.webdriver.io', () => {

   
    it('should demonstrate the getAttribute command', async () => {

        browser.url('https://v5.webdriver.io')

        const input = await $('#search_input_react')

        let attr = await input.getAttribute('title')
        console.log("Title attribute is: " + attr) // outputs: "search"

        await input.setValue('test124');
        
        attr = await input.getAttribute('value')
        console.log("Value attribute is:" +  attr) // outputs: test124

        
    })
})
 
PREVIOUS NEXT
Tagged: #attribute
ADD COMMENT
Topic
Name
7+3 =