コード例 #1
0
def track_events(target: ElementHandle) -> JSHandle:
    return target.evaluate_handle("""target => {
            const events = [];
            for (const event of [
                'mousedown', 'mouseenter', 'mouseleave', 'mousemove', 'mouseout', 'mouseover', 'mouseup', 'click',
                'pointercancel', 'pointerdown', 'pointerenter', 'pointerleave', 'pointermove', 'pointerout', 'pointerover', 'pointerup',
                'touchstart', 'touchend', 'touchmove', 'touchcancel',])
                target.addEventListener(event, () => events.push(event), false);
            return events;
        }""")
コード例 #2
0
    def trackElementHandle(self,
                           elementHandle: sync_api.ElementHandle,
                           name: str,
                           options: ElementHandleTrackOptions = None):
        screenshotOptions = _to_dict(
            options.screenshotOptions) if options else {}
        screenshot = elementHandle.screenshot(**screenshotOptions)
        imageBase64 = base64.b64encode(screenshot).decode('ascii')

        self.track(
            TestRun(
                name,
                imageBase64,
                options.agent.os if options and options.agent else None,
                self.browser.name,
                options.agent.viewport if options and options.agent else None,
                options.agent.device if options and options.agent else None,
                options.diffTollerancePercent if options else None,
                options.ignoreAreas if options else None,
            ))
コード例 #3
0
 def find_toggler(self, node_element: ElementHandle) -> ElementHandle:
     toggler = node_element.query_selector(".jqtree-toggler")
     assert toggler
     return toggler
コード例 #4
0
 def el_text(el: ElementHandle):
     return el.inner_text()