:) use of: Appium sibling (preceding-sibling: :) and younger brother node (following-sibling

FIG positioning elements red box, should be only the same class, may also be positioned using Xpath thereof (

driver.find_element_by_xpath("/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/                                android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View[1]/android.view.View[3]))下面红框的元素,或者
driver.find_element_by_xpath ( "// android.webkit.WebView [@ content-desc = 'self-rated health record'] /android.view.View [1] /android.view.View [3]") to the positioning element. Use brother node (following-sibling: :) positioned intermediate the red box "healthy self-test records" having content-desc tag,
driver.find_element_by_xpath ( "// android.view.View [@ content-desc = 'self-rated health record'] /following-sibling::android.view.View [1]"), android.view.View [1] is a brother element relative to the first "self-rated health record" is concerned, with [1] in FIG.

Brothers positioning element (preceding-sibling: :)

Also located "self-rated health record" red frame elements above, driver.find_element_by_xpath ( "// android.view.View [@ content-desc = 'self-rated health record'] /preceding-sibling::android.view.View [1] "), android.view.View [1], which represents the first sibling.

Published 17 original articles · won praise 2 · Views 5275

Guess you like

Origin blog.csdn.net/tiekun888/article/details/98870888