Update chrome.js

This commit is contained in:
Namhyeon Go 2021-08-20 11:11:37 +09:00 committed by GitHub
parent 5d9703b199
commit 6c48902cca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -548,7 +548,7 @@ var ChromeObject = function() {
this.getNestedElementPosition = function(selector, subSelector, searchText) {
var s = '';
if (searchText.indexOf(':p(') != 0) {
s += '(function() {'
+ ' var elements = Object.values(document.querySelectorAll("' + selector + '")).filter(function(x) {'
@ -570,7 +570,7 @@ var ChromeObject = function() {
+ ' return (Math.random() < ' + p + ');'
+ ' });'
+ ' if (elements.length > 0) {'
+ ' var rect = elements[0].getBoundingClientRect();'
+ ' var rect = elements[0].querySelector("' + subSelector + '").getBoundingClientRect();'
+ ' return [parseInt(rect.left), parseInt(rect.top), parseInt(rect.x), parseInt(rect.y), parseInt(rect.right), parseInt(rect.bottom)].join(",");'
+ ' } else {'
+ ' return "";'
@ -581,8 +581,8 @@ var ChromeObject = function() {
s += '(function() {'
+ ' var elements = Object.values(document.querySelectorAll("' + selector + '"));'
+ ' if (elements.length > 0) {'
+ ' var element = elements[Math.floor(Math.random() * elements.length)];';
+ ' var rect = element.getBoundingClientRect();'
+ ' var k = Math.floor(Math.random() * elements.length);'
+ ' var rect = elements[k].querySelector("' + subSelector + '").getBoundingClientRect();'
+ ' return [parseInt(rect.left), parseInt(rect.top), parseInt(rect.x), parseInt(rect.y), parseInt(rect.right), parseInt(rect.bottom)].join(",");'
+ ' } else {'
+ ' return "";'