我想通过使用java在以下脚本中阅读WebPageId。
你能帮我解决一下吗?功能:
jQuery(document).ready(function() {
try{_paq.push(["setSid", 8]);
_paq.push(["setSid","environment"]);
(function () {
var configarray = ['www.xyz.com'];
if (configarray.indexOf(window.location.hostname)!=-1)
{_paq.push(['setCVariable','1','webPageId',12345,'page']);
_paq.push(["trackPageView"]);}
答案 0 :(得分:0)
您需要使用以下语法将变量设置为返回的javascript:
WebDriver driver = new AnyDriverYouWant();
JavascriptExecutor js;
if (driver instanceof JavascriptExecutor) {
js = (JavascriptExecutor)driver;
} // else throw...
// later on...
js.executeScript("return document.getElementById('someId');");