|
|
@ -75,20 +75,50 @@ def UIOTextGet(inUIO) -> str:
|
|
|
|
def UIOAttributeGet(inUIO, inAttributeStr) -> str:
|
|
|
|
def UIOAttributeGet(inUIO, inAttributeStr) -> str:
|
|
|
|
return inUIO.get_attribute(inAttributeStr)
|
|
|
|
return inUIO.get_attribute(inAttributeStr)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def UIOAttributeStyleGet(inUIO, inAttributeStr) -> str:
|
|
|
|
|
|
|
|
return inUIO.get_attribute(inAttributeStr)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#TODO
|
|
|
|
|
|
|
|
#def UIOAttributeSet(inUIO, inAttributeStr) -> str:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#def UIOAttributeStyleSet(inUIO, inAttributeStr) -> str:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def UIOClick(inUIO):
|
|
|
|
def UIOClick(inUIO):
|
|
|
|
inUIO.click()
|
|
|
|
inUIO.click()
|
|
|
|
|
|
|
|
|
|
|
|
def UIOSelectorDraw(inUIOSelectorStr: str, inIsFirst:bool=False):
|
|
|
|
def UIOSelectorHighlight(inUIOSelectorStr: str, inIsFirst:bool=False, inDurationSecFloat:float=3.0, inColorStr:str="green"):
|
|
|
|
lList = UIOSelectorList(inUIOSelectorStr=inUIOSelectorStr)
|
|
|
|
|
|
|
|
global gBrowser
|
|
|
|
global gBrowser
|
|
|
|
lBrowserRect = gBrowser.get_window_rect()
|
|
|
|
if inIsFirst == True:
|
|
|
|
lViewportHeightInt = PageJSExecute(inJSStr=f"return $(window).height();")
|
|
|
|
lJSStr = \
|
|
|
|
lBrowserRect["y"]= lBrowserRect["y"] + (lBrowserRect["height"] - lViewportHeightInt)
|
|
|
|
f"var lElementList = document.querySelectorAll(\"{inUIOSelectorStr}\");" \
|
|
|
|
if inIsFirst == True and len(lList)>0: lList = [lList[0]]
|
|
|
|
f"if (lElementList.length>0) {{ lElementList=[lElementList[0]]; }}" \
|
|
|
|
for lItem in lList:
|
|
|
|
f"for (var lIndexInt=0; lIndexInt<lElementList.length;lIndexInt++) {{" \
|
|
|
|
lRect = lItem.rect
|
|
|
|
f" lElement=lElementList[lIndexInt];" \
|
|
|
|
lBox = Screen.BoxCreate(inTopInt=round(lRect['y']+lBrowserRect['y']), inLeftInt=round(lRect['x']+lBrowserRect['x']), inHeightInt=round(lRect['height']), inWidthInt=round(lRect['width']))
|
|
|
|
f" lElement.ORPABackupStyleOutline = lElement.style[\"outline\"];" \
|
|
|
|
Screen.BoxDraw(inBox=lBox)
|
|
|
|
f" lElement.style[\"outline\"]=\"2px solid {inColorStr}\";" \
|
|
|
|
|
|
|
|
f"}}" \
|
|
|
|
|
|
|
|
f"window.ORPAOutlineList = lElementList;"
|
|
|
|
|
|
|
|
PageJSExecute(inJSStr=lJSStr)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
lJSStr = \
|
|
|
|
|
|
|
|
f"var lElementList = document.querySelectorAll(\"{inUIOSelectorStr}\");" \
|
|
|
|
|
|
|
|
f"for (var lIndexInt=0; lIndexInt<lElementList.length;lIndexInt++) {{" \
|
|
|
|
|
|
|
|
f" lElement=lElementList[lIndexInt];" \
|
|
|
|
|
|
|
|
f" lElement.ORPABackupStyleOutline = lElement.style[\"outline\"];" \
|
|
|
|
|
|
|
|
f" lElement.style[\"outline\"]=\"2px solid {inColorStr}\";" \
|
|
|
|
|
|
|
|
f"}}" \
|
|
|
|
|
|
|
|
f"window.ORPAOutlineList = lElementList;"
|
|
|
|
|
|
|
|
PageJSExecute(inJSStr=lJSStr)
|
|
|
|
|
|
|
|
time.sleep(inDurationSecFloat)
|
|
|
|
|
|
|
|
lJSStr = \
|
|
|
|
|
|
|
|
f"var lElementList = window.ORPAOutlineList;" \
|
|
|
|
|
|
|
|
f"for (var lIndexInt=0; lIndexInt<lElementList.length;lIndexInt++) {{" \
|
|
|
|
|
|
|
|
f" lElement=lElementList[lIndexInt];" \
|
|
|
|
|
|
|
|
f" lElement.style[\"outline\"]=lElement.ORPABackupStyleOutline;" \
|
|
|
|
|
|
|
|
f"}}" \
|
|
|
|
|
|
|
|
f"delete window.ORPAOutlineList;"
|
|
|
|
|
|
|
|
PageJSExecute(inJSStr=lJSStr)
|
|
|
|
|
|
|
|
|
|
|
|
def UIOSelectorClick(inUIOSelectorStr: str):
|
|
|
|
def UIOSelectorClick(inUIOSelectorStr: str):
|
|
|
|
PageJSExecute(inJSStr=f"document.querySelector('{inUIOSelectorStr}').click()")
|
|
|
|
PageJSExecute(inJSStr=f"document.querySelector('{inUIOSelectorStr}').click()")
|
|
|
@ -100,13 +130,13 @@ def UIOSelectorWaitAppear(inUIOSelectorStr:str, inWaitSecFloat:float=UIO_WAIT_SE
|
|
|
|
lResultList = UIOSelectorList(inUIOSelectorStr=inUIOSelectorStr)
|
|
|
|
lResultList = UIOSelectorList(inUIOSelectorStr=inUIOSelectorStr)
|
|
|
|
if len(lResultList)>0: break
|
|
|
|
if len(lResultList)>0: break
|
|
|
|
time.sleep(inWaitIntervalSecFloat)
|
|
|
|
time.sleep(inWaitIntervalSecFloat)
|
|
|
|
|
|
|
|
if time.time() - lStartSecFloat > inWaitSecFloat: raise Exception(f"Wait time is over. No element has been appear")
|
|
|
|
return lResultList
|
|
|
|
return lResultList
|
|
|
|
|
|
|
|
|
|
|
|
def UIOSelectorWaitDisappear(inUIOSelectorStr:str, inWaitSecFloat:float=UIO_WAIT_SEC_FLOAT, inWaitIntervalSecFloat:float = UIO_WAIT_INTERVAL_SEC_FLOAT):
|
|
|
|
def UIOSelectorWaitDisappear(inUIOSelectorStr:str, inWaitSecFloat:float=UIO_WAIT_SEC_FLOAT, inWaitIntervalSecFloat:float = UIO_WAIT_INTERVAL_SEC_FLOAT):
|
|
|
|
lStartSecFloat = time.time()
|
|
|
|
lStartSecFloat = time.time()
|
|
|
|
lResultList=[]
|
|
|
|
|
|
|
|
while time.time() - lStartSecFloat < inWaitSecFloat:
|
|
|
|
while time.time() - lStartSecFloat < inWaitSecFloat:
|
|
|
|
lResultList = UIOSelectorList(inUIOSelectorStr=inUIOSelectorStr)
|
|
|
|
lResultList = UIOSelectorList(inUIOSelectorStr=inUIOSelectorStr)
|
|
|
|
if len(lResultList)==0: break
|
|
|
|
if len(lResultList)==0: break
|
|
|
|
time.sleep(inWaitIntervalSecFloat)
|
|
|
|
time.sleep(inWaitIntervalSecFloat)
|
|
|
|
return lResultList
|
|
|
|
if time.time() - lStartSecFloat > inWaitSecFloat: raise Exception(f"Wait time is over. No element has been disappear")
|