CodeceptJS icon indicating copy to clipboard operation
CodeceptJS copied to clipboard

Grabbing a text from a selector fails, when innerText of specified element = '0' on Chrome with Webdriver

Open AlinaKr opened this issue 3 years ago • 0 comments

Hello, I would like to report a bug.

What are you trying to achieve?

Trying to grab text from a selector, in my case an i tag when running codeceptjs test with webdriver on Chrome. => await I.grabTextFrom('.bookmark-amount') It works on Firefox yet not on Chrome when the inner text corresponds to '0'. Neither does it fail when this test is executed with playwright. In case of other numbers it works just fine.

The HTML structure is as follows:

<div class="jsx-2676253260 right"><a rel="nofollow" class="jsx-2693983409 bookmark" href="/bookmarks"><i class="jsx-2693983409 bookmark-amount">0</i></a></div>

What do you get instead?

console output

     Element ".bookmark-amount" was not found by text|CSS|XPath
      at new ElementNotFound (node_modules/codeceptjs/lib/helper/errors/ElementNotFound.js:14:11)
      at assertElementExists (node_modules/codeceptjs/lib/helper/WebDriver.js:2823:11)
      at WebDriver.grabTextFrom (node_modules/codeceptjs/lib/helper/WebDriver.js:1170:5)

Details

  • Codeception version: ^3.0.5
  • Operating System: MacOS Big Sur 11.1
  • ChromeDriver/Chrome 97.0.4692.71
  • Selenium standalone server: ^6.24.0
  • NodeJS Version: 14.17.6
  • webdriverio: 6.4.2

as well as with

  • Codeception version: 2.6.8
  • Selenium standalone server: 6.19.0
  • NodeJS Version: 14.16.1
  • webdriverio: 6.4.2

Workaround

I used the grabHtmlFrom function instead.

Thank you in advance!

AlinaKr avatar Jan 11 '22 22:01 AlinaKr