示例#1
0
class DomSnapshotScriptForIE(DomSnapshotScript):
    _script_code = resource.get_resource("processPagePollForIE.js")
    _poll_result_code = resource.get_resource("pollResultForIE.js")

    def process_page_script_code(self, args):
        # type: (Text) -> Text
        return "{} return __processPagePollForIE({});".format(
            self._script_code, args)

    def poll_result_script_code(self, args):
        # type: (Text) -> Text
        return "{} return __pollResultForIE({});".format(
            self._poll_result_code, args)
var index = 1;
if (parent !== null) {
var children = parent.children;
for (var childIdx in children) {
var child = children[childIdx];
if (child === el) break;
if (child.tagName === el.tagName) index++;
}
}
xpath = '/' + el.tagName + '[' + index + ']' + xpath;
el = parent;
} while (el !== null);
return '/' + xpath;"""


PROCESS_RESOURCES = resource.get_resource("processPageAndPoll.js")
DOM_EXTRACTION_TIMEOUT = 5 * 60 * 1000


@attr.s
class WebElementRegion(object):
    region_provider = attr.ib()  # type: Union[Text, GetRegion]
    _webelement = attr.ib()  # type: AnyWebElement

    @property
    def webelement(self):
        return eyes_selenium_utils.get_underlying_webelement(self._webelement)


class VisualGridEyes(object):
    vg_manager = None  # type: VisualGridRunner
def test_open_resource_no_error():
    get_resource("processPageAndSerializePoll.js")
var parent = el.parentElement;
var index = 1;
if (parent !== null) {
var children = parent.children;
for (var childIdx in children) {
var child = children[childIdx];
if (child === el) break;
if (child.tagName === el.tagName) index++;
}
}
xpath = '/' + el.tagName + '[' + index + ']' + xpath;
el = parent;
} while (el !== null);
return '/' + xpath;"""

PROCESS_RESOURCES = resource.get_resource("processPageAndSerializePoll.js")
PROCESS_RESOURCES_FOR_IE = resource.get_resource(
    "processPageAndSerializePollForIE.js")
DOM_EXTRACTION_TIMEOUT = 5 * 60 * 1000


@attr.s
class WebElementRegion(object):
    region_provider = attr.ib()  # type: Union[Text, GetRegion]
    _webelement = attr.ib()  # type: AnyWebElement

    @property
    def webelement(self):
        return eyes_selenium_utils.get_underlying_webelement(self._webelement)

示例#5
0
def test_open_resource_is_unicode():
    assert type(get_resource("pollResult.js")) is Text
)
from applitools.common.utils.efficient_string_replace import (
    clean_for_json,
    efficient_string_replace,
)
from applitools.common.utils.json_utils import JsonInclude
from applitools.selenium import eyes_selenium_utils
from applitools.selenium.positioning import ScrollPositionProvider
from applitools.selenium.resource import get_resource

if tp.TYPE_CHECKING:
    from applitools.common.utils.custom_types import AnyWebDriver
    from applitools.selenium.webdriver import EyesWebDriver

__all__ = ("get_full_window_dom", )
_CAPTURE_FRAME_SCRIPT = (get_resource("captureDomAndPoll.js") +
                         "return __captureDomAndPoll();")
_CAPTURE_FRAME_SCRIPT_FOR_IE = (get_resource("captureDomAndPollForIE.js") +
                                "return __captureDomAndPollForIE();")
DOM_EXTRACTION_TIMEOUT = 5 * 60 * 1000
CSS_DOWNLOAD_TIMEOUT = 30  # Secs


@attr.s
class Separators(object):
    separator = attr.ib(metadata={JsonInclude.THIS: True})  # type: Text
    css_start_token = attr.ib(metadata={JsonInclude.THIS: True})  # type: Text
    css_end_token = attr.ib(metadata={JsonInclude.THIS: True})  # type: Text
    iframe_start_token = attr.ib(metadata={JsonInclude.THIS:
                                           True})  # type: Text
    iframe_end_token = attr.ib(metadata={JsonInclude.THIS: True})  # type: Text