2014-02-27 4 views
0

В автоматизации пользовательского интерфейса есть способ экспортировать дерево элементов, сгенерированное с помощью logElementTree(), в формате, отличном от стандартного (например, XML). Я хотел бы использовать иерархию элементов вне автоматизации пользовательского интерфейса.Автоматизация пользовательского интерфейса: дерево элементов экспорта

Я записал дерево, используя logElementTree() в тестовом скрипте, и он успешно завершен, показывая в журнале редактора как «пройденный». Я попытался «Экспортировать отслеживаемые результаты», но, похоже, это не трюк.

ответ

0

http://www.w3schools.com/xsl/xsl_transformation.asp

Would что-то вроде выше работы?

Например, что-то вроде этого будет примерно разобрать результаты теста в HTML таблице:

<table border="1" style="width:800px"> 
        <tr> 
        <th>Timestammp</th> 
        <th>Sequence</th> 
        <th>Message</th> 
        <th>Type</th> 
        <th>Screenshot</th> 
        </tr> 
<xsl:for-each select="plist/dict/array/dict"> 
         <tr> 
          <td> 
           <xsl:value-of select="translate(translate(date, 'T',' '), 'Z','')"/> 
          </td> 
          <td><xsl:value-of select="position()"/></td> 
          <td><xsl:value-of select="string"/></td> 
          <td> 
           <xsl:choose> 
            <xsl:when test="integer = 8"><span style="color:blue">Screenshot</span></xsl:when> 
            <xsl:when test="integer = 5"><span style="color:green">Pass</span></xsl:when> 
            <xsl:when test="integer = 4"><span style="color:orange">Message</span></xsl:when> 
            <xsl:otherwise><xsl:value-of select="integer"/></xsl:otherwise> 
           </xsl:choose> 
          </td> 
          <td> 
           <xsl:if test="integer = 8"> 
            <xsl:element name="img"> 
             <xsl:attribute name="src"><xsl:value-of select="string"/>.png</xsl:attribute> 
             <xsl:attribute name="style">height:250px;width:167px;</xsl:attribute> 
            </xsl:element> 
           </xsl:if> 
          </td> 
         </tr> 
        </xsl:for-each> 
       </table> 

Так же, как примечание это было время, так как я использовал это, потому что я не этот момент в моем проекте все же, и я верю, что большая часть его была из чьего-то блога. Если я смогу снова найти сайт, я отправлю ему кредит.

1

Вы можете использовать Appium инспектор, чтобы получить результат XML: Appium

Appium является открытой рамкой автоматизации источника. Он также предоставляет инструменты для получения иерархии пользовательского интерфейса приложения.

Следуйте инструкциям и запустите инспектора Appium. Заполните требуемую информацию, такую ​​как тип устройства и UDID. Скриншот: Appium Inspector

Используйте графический интерфейс Appium и в правом нижнем углу есть кнопка «Копировать XML». Нажмите кнопку обновления, чтобы получить иерархию пользовательского интерфейса текущего экрана.

Вот результат использования калькулятора.

<?xml version="1.0" encoding="UTF-8"?> 
<AppiumAUT> 
    <UIAApplication name="Calculator" label="Calculator" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0" x="0" y="20" width="320" height="548"> 
     <UIAWindow name="" label="" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0" x="0" y="0" width="320" height="568"> 
      <UIAStaticText name="Result" label="Result" value="0" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/0" x="0" y="0" width="320" height="168"> 
      </UIAStaticText> 
      <UIAButton name="all clear" label="all clear" value="all clear" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/1" x="1.5" y="169.5" width="78.5" height="79"> 
      </UIAButton> 
      <UIAButton name="plus, minus" label="plus, minus" value="plus, minus" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/2" x="80.5" y="169.5" width="79" height="79"> 
      </UIAButton> 
      <UIAButton name="percent" label="percent" value="percent" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/3" x="160" y="169.5" width="79" height="79"> 
      </UIAButton> 
      <UIAButton name="divide" label="divide" value="divide" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/4" x="239.5" y="169.5" width="79" height="79"> 
      </UIAButton> 
      <UIAButton name="7" label="7" value="7" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/5" x="1.5" y="249" width="78.5" height="79"> 
      </UIAButton> 
      <UIAButton name="8" label="8" value="8" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/6" x="80.5" y="249" width="79" height="79"> 
      </UIAButton> 
      <UIAButton name="9" label="9" value="9" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/7" x="160" y="249" width="79" height="79"> 
      </UIAButton> 
      <UIAButton name="multiply" label="multiply" value="multiply" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/8" x="239.5" y="249" width="79" height="79"> 
      </UIAButton> 
      <UIAButton name="4" label="4" value="4" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/9" x="1.5" y="328.5" width="78.5" height="79"> 
      </UIAButton> 
      <UIAButton name="5" label="5" value="5" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/10" x="80.5" y="328.5" width="79" height="79"> 
      </UIAButton> 
      <UIAButton name="6" label="6" value="6" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/11" x="160" y="328.5" width="79" height="79"> 
      </UIAButton> 
      <UIAButton name="subtract" label="subtract" value="subtract" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/12" x="239.5" y="328.5" width="79" height="79"> 
      </UIAButton> 
      <UIAButton name="1" label="1" value="1" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/13" x="1.5" y="408" width="78.5" height="79"> 
      </UIAButton> 
      <UIAButton name="2" label="2" value="2" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/14" x="80.5" y="408" width="79" height="79"> 
      </UIAButton> 
      <UIAButton name="3" label="3" value="3" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/15" x="160" y="408" width="79" height="79"> 
      </UIAButton> 
      <UIAButton name="add" label="add" value="add" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/16" x="239.5" y="408" width="79" height="79"> 
      </UIAButton> 
      <UIAButton name="0" label="0" value="0" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/17" x="1.5" y="487.5" width="157" height="79"> 
      </UIAButton> 
      <UIAButton name="decimal" label="decimal" value="decimal" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/18" x="160" y="487.5" width="79" height="79"> 
      </UIAButton> 
      <UIAButton name="equals" label="equals" value="equals" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/19" x="239.5" y="487.5" width="79" height="79"> 
      </UIAButton> 
     </UIAWindow> 
     <UIAWindow name="" label="" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1" x="0" y="0" width="320" height="568"> 
      <UIAStatusBar name="" label="" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/0" x="0" y="0" width="320" height="20"> 
       <UIAElement name="2 of 5 bars, signal strength" label="2 of 5 bars, signal strength" value="" dom="" enabled="true" valid="true" visible="true" hint="Swipe down with three fingers to reveal the notification center., Swipe up with three fingers to reveal the control center, Double-tap to scroll to top" path="/0/1/0/0" x="6" y="0" width="35" height="20"> 
       </UIAElement> 
       <UIAElement name="T-Mobile network" label="T-Mobile network" value="" dom="" enabled="true" valid="true" visible="true" hint="Swipe down with three fingers to reveal the notification center., Swipe up with three fingers to reveal the control center, Double-tap to scroll to top" path="/0/1/0/1" x="44" y="0" width="48" height="20"> 
       </UIAElement> 
       <UIAElement name="3 of 3 Wi-Fi bars" label="3 of 3 Wi-Fi bars" value="FireEye" dom="" enabled="true" valid="true" visible="true" hint="Swipe down with three fingers to reveal the notification center., Swipe up with three fingers to reveal the control center, Double-tap to scroll to top" path="/0/1/0/2" x="97" y="0" width="13" height="20"> 
       </UIAElement> 
       <UIAElement name="10:48 AM" label="10:48 AM" value="" dom="" enabled="true" valid="true" visible="true" hint="Swipe down with three fingers to reveal the notification center., Swipe up with three fingers to reveal the control center, Double-tap to scroll to top" path="/0/1/0/3" x="134" y="0" width="52" height="20"> 
       </UIAElement> 
       <UIAElement name="95% battery power, Charging" label="95% battery power, Charging" value="" dom="" enabled="true" valid="true" visible="true" hint="Swipe down with three fingers to reveal the notification center., Swipe up with three fingers to reveal the control center, Double-tap to scroll to top" path="/0/1/0/4" x="282" y="0" width="33" height="20"> 
       </UIAElement> 
      </UIAStatusBar> 
     </UIAWindow> 
    </UIAApplication> 
</AppiumAUT> 
+0

Хотя эта ссылка может ответить на вопрос, лучше включить основные части ответа здесь и предоставить ссылку для справки. Ответные ссылки могут стать недействительными, если связанная страница изменится. – LittleBobbyTables

+0

Спасибо за ваш комментарий. Я отредактировал свой ответ. Пожалуйста, предложите, если я могу что-то улучшить. – Song

Смежные вопросы