當前位置: 首頁>>代碼示例>>Python>>正文


Python IAccessibleHandler.accChild方法代碼示例

本文整理匯總了Python中IAccessibleHandler.accChild方法的典型用法代碼示例。如果您正苦於以下問題:Python IAccessibleHandler.accChild方法的具體用法?Python IAccessibleHandler.accChild怎麽用?Python IAccessibleHandler.accChild使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在IAccessibleHandler的用法示例。


在下文中一共展示了IAccessibleHandler.accChild方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _get_firstChild

# 需要導入模塊: import IAccessibleHandler [as 別名]
# 或者: from IAccessibleHandler import accChild [as 別名]
 def _get_firstChild(self):
     # accNavigate incorrectly returns nothing for NAVDIR_FIRSTCHILD and requesting one child with AccessibleChildren causes a crash.
     # Therefore, we must use accChild(1).
     child = IAccessibleHandler.accChild(self.IAccessibleObject, 1)
     if not child:
         return None
     return IAccessible(IAccessibleObject=child[0], IAccessibleChildID=child[1])
開發者ID:RKelson93,項目名稱:nvda,代碼行數:9,代碼來源:msOffice.py

示例2: locateHTMLElementByID

# 需要導入模塊: import IAccessibleHandler [as 別名]
# 或者: from IAccessibleHandler import accChild [as 別名]
def locateHTMLElementByID(document,ID):
	try:
		element=document.getElementsByName(ID).item(0)
	except COMError as e:
		log.debugWarning("document.getElementsByName failed with COMError %s"%e)
		element=None
	if element:
		return element
	try:
		nodeName=document.body.nodeName
	except COMError as e:
		log.debugWarning("document.body.nodeName failed with COMError %s"%e)
		return None
	if nodeName=="FRAMESET":
		tag="frame"
	else:
		tag="iframe"
	try:
		frames=document.getElementsByTagName(tag)
	except COMError as e:
		log.debugWarning("document.getElementsByTagName failed with COMError %s"%e)
		return None
	for frame in frames:
		pacc=IAccessibleFromHTMLNode(frame)
		res=IAccessibleHandler.accChild(pacc,1)
		if not res: continue
		childElement=HTMLNodeFromIAccessible(res[0])
		if not childElement: continue
		childElement=locateHTMLElementByID(childElement.document,ID)
		if not childElement: continue
		return childElement
開發者ID:atsuoishimoto,項目名稱:tweetitloud,代碼行數:33,代碼來源:MSHTML.py

示例3: getChildHTMLNodeFromFrame

# 需要導入模塊: import IAccessibleHandler [as 別名]
# 或者: from IAccessibleHandler import accChild [as 別名]
def getChildHTMLNodeFromFrame(frame):
	try:
		pacc=IAccessibleFromHTMLNode(frame)
	except NotImplementedError:
		# #1569: It's not possible to get an IAccessible from frames marked with an ARIA role of presentation.
		# In this case, just skip this frame.
		return
	res=IAccessibleHandler.accChild(pacc,1)
	if not res: return
	return HTMLNodeFromIAccessible(res[0])
開發者ID:pcguruuu,項目名稱:git-git.nvaccess.org-nvda,代碼行數:12,代碼來源:MSHTML.py

示例4: locateHTMLElementByID

# 需要導入模塊: import IAccessibleHandler [as 別名]
# 或者: from IAccessibleHandler import accChild [as 別名]
def locateHTMLElementByID(document, ID):
    try:
        elements = document.getElementsByName(ID)
        if elements is not None:
            element = elements.item(0)
        else:  # probably IE 10 in standards mode (#3151)
            try:
                element = document.all.item(ID)
            except:
                element = None
    except COMError as e:
        log.debugWarning("document.getElementsByName failed with COMError %s" % e)
        element = None
    if element:
        return element
    try:
        nodeName = document.body.nodeName
    except COMError as e:
        log.debugWarning("document.body.nodeName failed with COMError %s" % e)
        return None
    if nodeName:
        nodeName = nodeName.upper()
    if nodeName == "FRAMESET":
        tag = "frame"
    else:
        tag = "iframe"
    try:
        frames = document.getElementsByTagName(tag)
    except COMError as e:
        log.debugWarning("document.getElementsByTagName failed with COMError %s" % e)
        return None
    if not frames:  # frames can be None in IE 10
        return None
    for frame in frames:
        try:
            pacc = IAccessibleFromHTMLNode(frame)
        except NotImplementedError:
            # #1569: It's not possible to get an IAccessible from frames marked with an ARIA role of presentation.
            # In this case, just skip this frame.
            continue
        res = IAccessibleHandler.accChild(pacc, 1)
        if not res:
            continue
        childElement = HTMLNodeFromIAccessible(res[0])
        if not childElement:
            continue
        childElement = locateHTMLElementByID(childElement.document, ID)
        if not childElement:
            continue
        return childElement
開發者ID:sonar-gnu-linux,項目名稱:nvda,代碼行數:52,代碼來源:MSHTML.py


注:本文中的IAccessibleHandler.accChild方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。