var click_textContent = '
var father_level = 0;
var child_ctl = "";
var child_ctl_tmp = "";
var next_focusedElement = null;
= null;
("click", function(event) {
= ;
();
father_level = 0;
myDispose_click();
});
function myDispose_click(focusedElement) {
(`commencement father${father_level} -------------------------`);
let tag_name = ();
let outerHTML = ;
(outerHTML);
if (tag_name === "body") {
let xpath = getElementfullXPath(next_focusedElement);
let elements = (xpath, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
if (elements && === 1) {
(`(driver, , "${xpath}")`);
("close:tagnamedbody");
(`close father${father_level} -------------------------`);
return xpath;
} else {
("close:tagnamedbody");
(`close father${father_level} -------------------------`);
return null;
}
}
let my_all_value = "";
let text = ().replace(/"/g, "\\\"");
if (text !== "" && !("\\n")) {
my_all_value = `contains(text(),\'${text}\')`;
if (myDispose_count_number(text, "text", tag_name)) {
let xpath = `//${tag_name}[${my_all_value}]`;
let parameter = `driver, , "${xpath}"`;
myDispose_success(parameter);
return parameter;
}
} else {
text = ""
}
let attributes = ;
(`Attribute Name List: ${(attributes).map(attr => ).join(",")}`);
for (let i = 0; i < ; i++) {
let attribute_name = attributes[i].name;
let attribute_value = attributes[i].value;
if (attribute_name === "class") {
let class_value_list = attribute_value.split(" ");
(`classlistings:${class_value_list}`);
if (class_value_list.includes("focusing")) {
class_value_list = class_value_list.filter(value => value !== "focusing");
}
for (let class_value of class_value_list) {
if (my_all_value === "") {
my_all_value = `contains(@class,"${class_value}")`;
} else {
my_all_value += ` and contains(@class,"${class_value}")`;
}
if (myDispose_count_number(class_value, attribute_name, tag_name)) {
let parameter = `driver, By.CLASS_NAME, "${class_value}"`;
myDispose_success(parameter);
return parameter;
}
let xpath = "";
if (text === "") {
xpath = `//${tag_name}[${my_all_value}]`;
} else {
xpath = `//${tag_name}[contains(text(),\'${text}\') and ${my_all_value}]`;
}
let result = myDispose_count_evaluate(xpath);
if (result) {
let parameter = `driver, , "${xpath}"`;
myDispose_success(parameter);
return parameter;
}
}
} else {
/*if (attribute_value === "" || /\d/.test(attribute_value)) {*/
if (attribute_value === "" || (attribute_name !== "src" && attribute_value.match(/[0-9]/))) {
continue;
}
if (my_all_value === "") {
my_all_value = `contains(@${attribute_name}, "${attribute_value}")`;
} else {
my_all_value += ` and contains(@${attribute_name}, "${attribute_value}")`;
}
if (myDispose_count_number(attribute_value, attribute_name, tag_name)) {
let xpath = `//${tag_name}[contains(@${attribute_name}, "${attribute_value}")]`;
let parameter = `driver, , "${xpath}"`;
myDispose_success(parameter);
return parameter;
}
let xpath = "";
if (text === "") {
xpath = `//${tag_name}[${my_all_value}]`;
} else {
xpath = `//${tag_name}[contains(text(),\'${text}\') and ${my_all_value}]`;
}
let result = myDispose_count_evaluate(xpath);
if (result) {
let parameter = `driver, , "${xpath}"`;
myDispose_success(parameter);
return parameter;
}
}
}
if (my_all_value !== "") {
let xpath = `//${tag_name}[${my_all_value}]`;
let result = myDispose_count_evaluate(xpath);
if (result) {
let parameter = `driver, , "${xpath}"`;
myDispose_success(parameter);
return parameter;
} else {
let textStr = `(driver, , "${xpath}")`;
("# fault1");
(textStr);
(`close father${father_level} -------------------------`);
if (father_level === 0) {
child_ctl = `father, , ".${xpath}"`;
child_ctl_tmp = `.${xpath}`;
next_focusedElement = focusedElement;
}
let father = ;
if (father) {
father_level++;
myDispose_click(father);
}
}
}
return null;
}
function myDispose_success(parameter) {
if (father_level === 0) {
(`(${parameter})`);
} else {
(`father = (${parameter})`);
(`(${child_ctl})`);
}
(`close father${father_level} -------------------------`);
}
function myDispose_count_evaluate(xpath) {
let elements = (xpath, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
if (father_level === 0) {
if ( === 1) {
return true
} else {
return null
}
} else {
if ( === 1) {
let firstElement = (0);
let result = (child_ctl_tmp, firstElement, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
if ( === 1) {
return true
} else {
return null
}
} else {
return null
}
}
}
function myDispose_count_number(attribute_value, attribute_name, tag_name) {
if (attribute_value === "") {
return null;
};
if (attribute_name !== "text" && attribute_name !== "src" && attribute_value.match(/[0-9]/)) {
return null;
};
let xpath;
if (attribute_name !== "text") {
xpath = `//${tag_name}[contains(@${attribute_name}, "${attribute_value}")]`;
} else {
xpath = `//${tag_name}[contains(text(), \'${attribute_value}\')]`;
};
let result = myDispose_count_evaluate(xpath);
if (result) {
(`${attribute_name}:"${attribute_value}" Appearance in web pages1substandard`);
return true;
} else {
(`${attribute_name}:"${attribute_value}" Appearance in web pages了多substandard`);
return null;
};
}
function getElementfullXPath(element) {
if (element && )
if (!(/[0-9]/)) {
return \'//*[@id="\' + + \'"]\';
}
if (element==null)
return "";
var index = 0;
var loacl_tagName = ;
var sibling = ;
var sibling_tagName = null;
if (sibling) {
sibling_tagName = ;
}
while (sibling && === 1 && loacl_tagName === sibling_tagName) {
index++;
sibling = ;
if (sibling) {
sibling_tagName = ;
} else {
sibling_tagName = null;
}
}
parent = ;
if (parent) {
var xpath = getElementfullXPath(parent);
if (xpath === "undefined") {
return "";
} else {
if (index === 0) {
xpath += "/" + ();
} else {
xpath += "/" + () + "[" + (index+1) + "]";
}
return xpath;
}
} else {
return "";
}
}
';
var input_textContent = '
let inputs = (`input[type="text"]`);
(input => {
("input", function(event) {
();
let parameter = myDispose_click();
if (parameter !== null) {
let textStr = `(${parameter}, "${}")`;
(textStr);
}
});
});
';
/*iframe*/
let iframes = ('iframe');
for (let i = 0; i < ; i++) {
let iframe = iframes[i];
if ( && ) {
let script = ('script');
= 'text/javascript';
= click_textContent;
(script);
let inputs = (`input[type="text"]`);
(input => {
("input", function(event) {
(this.value);
let parameter = myDispose_click();
if (parameter !== null) {
let textStr = `(${parameter}, "${}")`;
(textStr);
}
});
});
}
}
/*non-iframe*/
let script = ('script');
= 'text/javascript';
= click_textContent + input_textContent;
(script);