2gis / Winium.StoreApps.CodedUi

Prototype of Winium.StoreApps driver using CodedUI. Implements JsonWireProtocol for automation of Windows Phone applications
10 stars 8 forks source link

How fields are mapped in the page source? #24

Open pranavkhare opened 8 years ago

pranavkhare commented 8 years ago

I'm writing test for windows mobile hybrid application developed using Appache cordova template in Visual Studio. Using winium.StoreApps.CodedUi server exe generated by compiling the code i download from this git project

Below is the page source

      <W42-2147340287235 class="" id="" name="https://org1.contoso.com:444/nga/main.htm?org=org1&amp;liveid=1&amp;isfirstload=false&amp;frameOptions=ALLOW-FROM%20ms-appx%3A%2F%2Fmicrosoft.microsoftdynamicscrmforwindows8.1%2Fdefault.html" rect="{X=0,Y=0,Width=1080,Height=1920}">
        <W42-2147340287236 class="" id="" name="Microsoft Dynamics CRM" rect="{X=0,Y=0,Width=1080,Height=1920}">
          <W42-21473402872120 class="" id="" name="" rect="{X=864,Y=0,Width=216,Height=124}" />
          <W42-21473402872121 class="" id="" name="" rect="{X=216,Y=0,Width=324,Height=124}" />
          <W42-21473402872122 class="" id="" name="" rect="{X=0,Y=0,Width=216,Height=124}" />
          <W42-21473402872123 class="" id="" name="" rect="{X=540,Y=0,Width=324,Height=124}" />
          <W class="" id="" name="Sales Dashboard" rect="{X=59,Y=259,Width=286,Height=39}" />
          <W class="" id="" name="Home" rect="{X=54,Y=168,Width=181,Height=68}" />
          <W class="" id="" name="Pin frequently used records or views here" rect="{X=108,Y=456,Width=850,Height=62}" />
          <W class="" id="" name="My Activities" rect="{X=0,Y=0,Width=0,Height=0}" />
          <W42-21473402872126 class="" id="" name="New Record" rect="{X=0,Y=0,Width=0,Height=0}">
            <W42-21473402872127 class="" id="" name="" rect="{X=0,Y=0,Width=0,Height=0}" />
          </W42-21473402872126>
          <W class="" id="" name="No data available." rect="{X=0,Y=0,Width=0,Height=0}" />
          <W42-21473402872129 class="" id="offlineStatusButton" name="" rect="{X=47,Y=1906,Width=21,Height=5}" />
          <W42-21473402872131 class="" id="" name="" rect="{X=846,Y=1852,Width=182,Height=39}" />
          <W42-21473402872132 class="" id="" name="" rect="{X=0,Y=0,Width=0,Height=0}" />
          <W42-21473402872112 class="" id="" name="about:blank" rect="{X=0,Y=0,Width=0,Height=0}" />
          <W42-21473402872114 class="" id="" name="about:blank" rect="{X=0,Y=0,Width=0,Height=0}" />
          <W42-21473402872108 class="" id="" name="about:blank" rect="{X=0,Y=0,Width=0,Height=0}" />
          <W class="" id="" name="PR" rect="{X=734,Y=143,Width=42,Height=104}" />
        </W42-2147340287236>
      </W42-2147340287235>
    </W42-214734028721>
  </W42-214734028720>
</W>

  1. How this page source is generated and how the fields like id and class are mapped
  2. Why the page source is not shown as html as this is hybrid corodova app?
  3. I do not get values for class in the page source although it is present in the app code
NickAb commented 8 years ago

Driver uses CodedUI and Automation API to generate page source. So the page source is not an actual page source (html) of hybrid app, it is a representation of UI elements that are accessible by driver. For id and name AutomationProperies.AutomationId and AutomationProperies.Name properties are used. This was originally developed with 'native' apps in mind, not hybrid. In 'native' apps class corresponds to class of UI element, id and name to automation properties (that can be speciified programmatically or in XAML) as specified above. For web apps I do not know exact logic on how Windows translates html attributes to AutomationProperties.