Answer the question
In order to leave comments, you need to log in
How to get value inside phantomJS class?
Good afternoon, I can not get the value inside .
Using phantomjs, I log in, after which I cannot get strong with the ".sms-packages__count" class.
With a delay, everything is OK, I rendered the page. It just returns null.
Thanks in advance!
var webpage = require('webpage');
var page = webpage.create();
page.settings = {
loadImages: false,
javascriptEnabled: true,
encoding: "utf8",
userAgent: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36',
};
var page = require('webpage').create();
phantom.cookiesEnabled = true;
page.open("https://lk-ofd.taxcom.ru/#administration/features", function(status) {
if (status === "success") {
page.viewportSize = {
width: 1920,
height: 1080
};
page.evaluate(function() {
document.getElementById("authorization-email-input").value = "aaaaaaaa";
document.getElementById("authorization-password-input").value = "aaaaaaaa";
document.getElementById("authorization-email-input").dispatchEvent(new Event('input', { bubbles: true }));
document.getElementById("authorization-email-input").dispatchEvent(new Event('change', { bubbles: true }));
document.getElementById("authorization-password-input").dispatchEvent(new Event('input', { bubbles: true }));
document.getElementById("authorization-password-input").dispatchEvent(new Event('change', { bubbles: true }));
window.setTimeout(function() {
document.getElementById("authorization-submit-button").click();
}, 1500);
});
window.setTimeout(function() {
var elCount = page.content;
var t = elCount.querySelector('.sms-packages__count').innerHTML;
console.log(t);
page.render('screenAuth.png');
phantom.exit();
}, 8000);
}
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question