Arihant
Arihant

Reputation: 4047

Dalek and Phantomjs not detecting values put by javascript

I am using Dalek to automate test my webpage. The webpage makes a jQuery ajax API call and gets a JSON object in return. I use an attribute of that object to display data on my webpage.

When I try to run the test, it always fails and shows that no value was detected in that particular div with id name even though the name is being displayed.

Dalek Test:

test .open('http://localhost:3000/details.html?id=4')
.wait(2000)
.assert.title().is('User Details', 'User Details Displayed')
.assert.text('#username').is('Karianne','')
.done();

Result:

enter image description here

What is the reason behind this? Does PhantomJS doesn't execute jQuery?

Upvotes: 0

Views: 34

Answers (1)

Joe
Joe

Reputation: 11

Try to use a screenshot feature to see what is going on when the page loads:

.assert.text('#username').is('Karianne','')
.screenshot('/tmp/localhost_3000:datetime.png')

Upvotes: 1

Related Questions