When working on my webdriverIO script, I encountered a task where I needed to verify that a table cell contains a child element with the attribute title="value1" but not "value2". To handle the first part of this task, I utilized the following command:
expect(surveyCells[5].$('img')).toHaveAttr('title', 'Preview - Desktop Survey');
However, I faced a challenge with the second part of the task which required me to confirm that the element does not have a child element with the title 'Preview - Mobile Survey'. This is what I tried:
expect(surveyCells[5].$('img')).doesNotHaveAttr('title', 'Preview - Mobile Survey');