arjuna.interact.gui.auto.finder.translator module

class arjuna.interact.gui.auto.finder.translator.LocatorTranslator

Bases: object

Translates With Constructs to what underlying engines understand.

BASIC_LOCATORS = {<GenericLocateWith.WINDOW_PTITLE: 12>, <GenericLocateWith.XPATH: 3>, <GenericLocateWith.JS: 15>, <GenericLocateWith.NAME: 2>, <GenericLocateWith.IMAGE: 30>, <GenericLocateWith.ID: 1>, <GenericLocateWith.INDEX: 10>, <GenericLocateWith.WINDOW_TITLE: 11>}
NAMED_ARG_LOCATORS = {<GenericLocateWith.ATTR: 21>: "*[{name}*='{value}']", <GenericLocateWith.FATTR: 22>: "*[{name}='{value}']", <GenericLocateWith.BATTR: 23>: "*[{name}^='{value}']", <GenericLocateWith.EATTR: 24>: "*[{name}$='{value}']", <GenericLocateWith.POINT: 14>: 'return document.elementFromPoint({x}, {y})'}
NEED_TRANSLATION = {<GenericLocateWith.LINK: 6>: <GenericLocateWith.PARTIAL_LINK_TEXT: 31>, <GenericLocateWith.FLINK: 7>: <GenericLocateWith.LINK_TEXT: 32>, <GenericLocateWith.SELECTOR: 4>: <GenericLocateWith.CSS_SELECTOR: 34>}
TEXT_TRANSLATIONS = {'*text': '*//text()', '.text': '.', 'dot_text': '.', 'star_text': '*//text()', 'text': 'text()'}
XPATH_LOCATORS = {<GenericLocateWith.TEXT: 16>: "//*[contains(text(),'{}')]", <GenericLocateWith.FTEXT: 17>: "//*[text()='{}']", <GenericLocateWith.BTEXT: 18>: "//*[starts-with(text(),'{}')]", <GenericLocateWith.VALUE: 20>: "//*[@value='{}']", <GenericLocateWith.TITLE: 19>: "//*[@title='{}']", <GenericLocateWith.IMAGE_SRC: 29>: "//img[@src='{}']"}
XTYPE_LOCATORS = {<GuiElementType.TEXTBOX: 1>: "//input[@type='text']", <GuiElementType.PASSWORD: 2>: "//input[@type='password']", <GuiElementType.LINK: 3>: '//a', <GuiElementType.BUTTON: 4>: "//input[@type='button']", <GuiElementType.SUBMIT_BUTTON: 5>: "//input[@type='submit']", <GuiElementType.DROPDOWN: 6>: '//select', <GuiElementType.CHECKBOX: 7>: "//input[@type='checkbox']", <GuiElementType.RADIO: 8>: "//input[@type='radio']", <GuiElementType.IMAGE: 9>: '//img'}
classmethod translate(locator)