aboutsummaryrefslogtreecommitdiff
path: root/to-uiautomator.xsl
blob: f7d46af1bd79032787a610b06101846036ec3241 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?xml version="1.0"?>
<!-- To convert DroidDriver dump (say dd.xml) to UiAutomatorViewer format (say ua.uix), run: -->
<!-- xsltproc -o ua.uix to-uiautomator.xsl dd.xml -->
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:strip-space elements="*" />
  <xsl:template match="/">
    <hierarchy rotation="0">
      <xsl:apply-templates />
    </hierarchy>
  </xsl:template>
  <xsl:template match="*">
    <node>
      <xsl:attribute name="index"><xsl:value-of select="position()-1" /></xsl:attribute>
      <xsl:attribute name="text"><xsl:value-of select="@text" /></xsl:attribute>
      <xsl:attribute name="resource-id"><xsl:value-of select="@resource-id" /></xsl:attribute>
      <xsl:attribute name="class"><xsl:value-of select="@class" /></xsl:attribute>
      <xsl:attribute name="package"><xsl:value-of select="@package" /></xsl:attribute>
      <xsl:attribute name="content-desc"><xsl:value-of select="@content-desc" /></xsl:attribute>
      <xsl:attribute name="checkable"><xsl:value-of select="boolean(@checkable)" /></xsl:attribute>
      <xsl:attribute name="checked"><xsl:value-of select="boolean(@checked)" /></xsl:attribute>
      <xsl:attribute name="clickable"><xsl:value-of select="boolean(@clickable)" /></xsl:attribute>
      <xsl:attribute name="enabled"><xsl:value-of select="boolean(@enabled)" /></xsl:attribute>
      <xsl:attribute name="focusable"><xsl:value-of select="boolean(@focusable)" /></xsl:attribute>
      <xsl:attribute name="focused"><xsl:value-of select="boolean(@focused)" /></xsl:attribute>
      <xsl:attribute name="scrollable"><xsl:value-of select="boolean(@scrollable)" /></xsl:attribute>
      <xsl:attribute name="long-clickable"><xsl:value-of select="boolean(@long-clickable)" /></xsl:attribute>
      <xsl:attribute name="password"><xsl:value-of select="boolean(@password)" /></xsl:attribute>
      <xsl:attribute name="selected"><xsl:value-of select="boolean(@selected)" /></xsl:attribute>
      <xsl:if test="@selection-start">
        <xsl:attribute name="selection-start"><xsl:value-of select="@selection-start" /></xsl:attribute>
      </xsl:if>
      <xsl:if test="@selection-end">
        <xsl:attribute name="selection-end"><xsl:value-of select="@selection-end" /></xsl:attribute>
      </xsl:if>
      <xsl:attribute name="bounds"><xsl:value-of select="@bounds" /></xsl:attribute>
      <!-- These two attributes are added by DroidDriver to help diagnosis -->
      <!-- They are intentionally named in a different style -->
      <xsl:if test="@NotVisible">
        <xsl:attribute name="NotVisible">true</xsl:attribute>
      </xsl:if>
      <xsl:if test="@VisibleBounds">
        <xsl:attribute name="VisibleBounds"><xsl:value-of select="@VisibleBounds" /></xsl:attribute>
      </xsl:if>
      <xsl:apply-templates />
    </node>
  </xsl:template>
</xsl:transform>