lotus002673 发表于 2016-11-9 15:20:20

求助,元素定位

本帖最后由 lotus002673 于 2016-11-9 15:27 编辑


各位大侠,下图是用ui Automator Viewer捕捉到的图,我怎样定位到Button这个元素啊?



data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAW8AAADECAIAAADf8jfaAAAXGUlEQVR4nO2c227byJaG+VARIeii3yTyIYC6n6Njx7GzL9xI5hHS7XQMx/tG8wBBA0ngxNhO5mIkxMA4Gz1JuhX4JDtKBtBc8FBrVa0qlqwSJUr/B8Kg67BqVZH1s0iRKzoFgej8u/ef/z0/W+ffvWmPKKgSw+EwmrYPAIB5AGoCAAgD1AQAEAaoCQAgDFATAEAYdDUZAgCAH1ATAEAYoCYAgDBATQAAYYCaAADCADUBAIQBagIACAPUBAAQBqgJACAMUBMAQBigJgCAMEBNAABhgJoAAMIANQEAhAFqAgAIA9QEABAGqAkAIAxQEwBAGKAmAIAwQE0AAGGAmgAAwgA1AQCEAWoCAAgD1AQAEAaoCQAgDBNRk+52I2q1h8PhcNhuRQmN7W76f7onVVJYCgWCODgN0kGxDJFYlg4gLctNDYfDdCCVLTKupJSz0RGqFLgHFooJqEl3u5GeTN3tBj3LkjNTZRvVSpvh5bRlbaXdytPFIWIWhFwiycRUXqXRaDC1SQsoY+5G/asUuwcWipHV5I8//nj48KHDojq/2Wzi6xVhki2kmtiGSEjgA2hRk0SqeX4+s7N9d6P+VTzcAwvFaGry/PnzH374odFo2A2SpQc/09U5Jq9OzNM6SWm38pWzsAJvt6LGdjtNb7XV0pu0kK/G80RpnuvGyYWXea+sKS+ovXSfFDM6qwbGNkR6OcMFcYyzgaV2sm7wdYSjUf8qHu6BhWIENUmk5Mcff3SqieW6616eZ8X5BExSyNWvRS6ZaTrRmmT+qjV4XoDNrFwpdOUyjQset1sRlxjTntovXpvYh8iZKw+l3GcysIXHZThSFR/3wELhqya5lPz0008uNaHrDus1UFyc2NYmRiG2LpCW5XSfriS4Tjn1TDNOxIQ5Lq35R1GTgGsT2ph8p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Tp4uICalJtOp3O+fn5R8KLn29Ft3/9KPHr7ejWzy/ELCDyayJ2lvEUefHzrVGKFzWdHbAbeCIyIfc+fvx4fn4ONak2iZr8+ef/YsM23Q1qUnmOj49PT08/f/78JwDT4/Pnz6enp8fHx9OeEDJQEy96vd6Hk5PT01Pbq0kAlMDp6emHkxNES6o8vV7v+P37MsL1AWDh+P37mZWSIdQEABAKqAkAIAxQEwBAGKAmAIAwQE0AAGGAmgAAwgA1AQCEAWoCAAgD1AQAEAaoCQAgDFATAEAYoCYAgDBATQAAYYCaAADCADUBAIQBagIACAPUBAAQBqgJACAMUBMAQBigJgCAMEBNAABhgJoAAMIANQEAhAFqAgAIA9QEABAGqAkAIAxQEwBAGKAmAIAwFKjJVwAA8KNATY69eZ/xP2Pz/Pnzx48fP3r06NGjR/9BMFMAWAQecR4/fvz8+fPxJ9pInHhgqsn/A8wypcR6ZZAFAAAAAElFTkSuQmCC

我试过 WebElement el = driver.findElementByXPath("//android.widget.RelativeLayout/android.widget.Button");

说element could not be located.

请大侠指点,多谢了

Miss_love 发表于 2016-11-9 15:44:16

用文本定位

Miss_love 发表于 2016-11-9 15:44:27

Miss_love 发表于 2016-11-9 15:44
用文本定位

text

lotus002673 发表于 2016-11-10 09:34:28

Miss_love 发表于 2016-11-9 15:44
text

好,我去试试

lotus002673 发表于 2016-11-10 10:21:57

Miss_love 发表于 2016-11-9 15:44
text

value=绔嬪嵆浣撻獙

控制台里显示为乱码,是不是不支持中文啊

SunFlower.Me 发表于 2017-3-6 11:02:45

求助value值相对定位我要定位的元素父类唯一 截取xpath为 /section/a   元素:<a class="list-group-item">中文名字</a>:'(
页: [1]
查看完整版本: 求助,元素定位