Reputation: 1677
I have the following code snippet in a testcafe script I am writting.
32: let NNT = Selector('#notNow').withText('No thanks, not at this time.')
33: button = Selector('.myclass')
34: let email = [email protected]
35: await t.click(button)
36: let emailS= Selector('#login-email')
37: await t.expect(emailS.visible).ok()
38: await t.debug()
39: await t.typeText(emailS,email)
But on line 38 i am getting the following error
Error on page "https://mywebpage.com":
Uncaught TypeError: Cannot read property 'top' of undefined
I realize this error means that the page my no longer exist however there definitly is a email box here is the html
<li>
<label for="login-email">Email Address</label>
<div class="input-box">
<input type="text" class="input-text required-entry validate-email" id="login-email" name="login[username]" value="">
</div>
</li>
So in this context what does this error mean. Thanks in advance.
Update: Upon deleting lines to see where the error is occurring I found the error is thrown immediately after it loads the page containing .myclass is loaded.
Upvotes: 4
Views: 201
Reputation: 1677
This was the problem the web site had some bad references that were not affecting the site but still testcafe was failing because of them. I ran it with the flag -e. Then the code works.
Upvotes: 2
Reputation: 362
where is this property 'top' being referenced? In this context it means that whatever object you are expecting the property 'top' to exist in, that object does not exist and therefore it is undefined
Upvotes: 3