@stainer

Как получить значение внутри класса phantomJS?

Добрый день, не могу получить значение внутри .
С помощью phantomjs авторизуюсь, после чего не могу получить strong с классом ".sms-packages__count".
С задержкой все ок, рендерил страницу. Просто null выдает.
Заранее спасибо!

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);
    }
});
  • Вопрос задан
  • 33 просмотра
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы