kopia lustrzana https://github.com/dgtlmoon/changedetection.io
Browser Steps - Adding "Wait for text" and "Wait for text in element" Re #1427
rodzic
89f1ba58b6
commit
e9e586205a
|
@ -31,6 +31,7 @@ browser_step_ui_config = {'Choose one': '0 0',
|
||||||
'Uncheck checkbox': '1 0',
|
'Uncheck checkbox': '1 0',
|
||||||
'Wait for seconds': '0 1',
|
'Wait for seconds': '0 1',
|
||||||
'Wait for text': '0 1',
|
'Wait for text': '0 1',
|
||||||
|
'Wait for text in element': '1 1',
|
||||||
# 'Press Page Down': '0 0',
|
# 'Press Page Down': '0 0',
|
||||||
# 'Press Page Up': '0 0',
|
# 'Press Page Up': '0 0',
|
||||||
# weird bug, come back to it later
|
# weird bug, come back to it later
|
||||||
|
@ -132,6 +133,17 @@ class steppable_browser_interface():
|
||||||
def action_wait_for_seconds(self, selector, value):
|
def action_wait_for_seconds(self, selector, value):
|
||||||
self.page.wait_for_timeout(int(value) * 1000)
|
self.page.wait_for_timeout(int(value) * 1000)
|
||||||
|
|
||||||
|
def action_wait_for_text(self, selector, value):
|
||||||
|
import json
|
||||||
|
v = json.dumps(value)
|
||||||
|
self.page.wait_for_function(f'document.querySelector("body").innerText.includes({v});', timeout=30000)
|
||||||
|
|
||||||
|
def action_wait_for_text_in_element(self, selector, value):
|
||||||
|
import json
|
||||||
|
s = json.dumps(selector)
|
||||||
|
v = json.dumps(value)
|
||||||
|
self.page.wait_for_function(f'document.querySelector({s}).innerText.includes({v});', timeout=30000)
|
||||||
|
|
||||||
# @todo - in the future make some popout interface to capture what needs to be set
|
# @todo - in the future make some popout interface to capture what needs to be set
|
||||||
# https://playwright.dev/python/docs/api/class-keyboard
|
# https://playwright.dev/python/docs/api/class-keyboard
|
||||||
def action_press_enter(self, selector, value):
|
def action_press_enter(self, selector, value):
|
||||||
|
|
Ładowanie…
Reference in New Issue