I am using WebDriverIO to do UI testing. I am trying to get this h1 tag:
This is my attempt:
it('should get the header of the intro text', () =>{
const h1 = $('#yui_3_17_2_1_1617935280900_2042');
expect(h1).toHaveValue("Confidence AI Application: machine learning models provide a systemized approach to assess cash flow risk and opportunity.");
});
The test fails:
[chrome 89.0.4389.114 linux #0-1] ✖ should get the header of the intro text
[chrome 89.0.4389.114 linux #0-1]
[chrome 89.0.4389.114 linux #0-1] 1 passing (14.2s)
[chrome 89.0.4389.114 linux #0-1] 1 failing
[chrome 89.0.4389.114 linux #0-1]
[chrome 89.0.4389.114 linux #0-1] 1) should get the header of the intro text
[chrome 89.0.4389.114 linux #0-1] Expect $(`yui_3_17_2_1_1617935280900_2042`) to have property value
Expected: "Confidence AI Application: machine learning models provide a systemized approach to assess cash flow risk and opportunity."
Received: undefined
[chrome 89.0.4389.114 linux #0-1] Error: Expect $(`yui_3_17_2_1_1617935280900_2042`) to have property value
How can I fix it?
This worked for me
it("should get the header of the intro text", () => {
const h1 = $("#yui_3_17_2_1_1617935280900_2042");
expect(h1.getText()).to.eq("Confidence AI Application: machine learning models provide a systemized approach to assess cash flow risk and opportunity.");
});