I write tests for a web portal. There is a code:

var transactionId; client .getAttribute("p.tac", "transaction-id").then(function(attr){ transactionId = attr; }) .click('a[href=#admin/' + transactionId + ']')//Это не работает!!! 

It is necessary that the href for the link is generated, based on the incoming ID , take it from the element's <p> attribute.

Update

An element with this href is on the page! The problem is that WebdriverIO does not want to accept this selector as a string, although typeof returns a string .

  • Do you have an element with such a link that you decide to click? - Visman

1 answer 1

I had such a problem with requests of the form

 .click('input[name=images[]]') 

It was necessary to shield the square brackets:

 .click('input[name=images\\[\\]]') 

Perhaps the # # grid is parsed as an id selector.