Forum Discussion

vibe's avatar
vibe
Occasional Contributor
13 years ago

Can't obtain web table using the FindChild method

Hi -



This works:



var iexplore;

  var page;

  iexplore = Sys.Process("iexplore", 2);

  iexplore.ToUrl("http://...");

  page = iexplore.Page("http://...");

  page.Form("form1").Panel(2).Panel(0).Panel(0).Panel(0).Panel(0).Panel(0).Panel(0).Table(0).Cell(0, 0).Table(0).Cell(1, 0).Panel(0).Panel(0).Panel(0).Table(0).Cell(0, 0).Table(0).Cell(2, 0).Table(0).Cell(0, 0).Panel("MainBodyPlaceholder_MainBodyPlaceholder_RFX_MyFRXPanel").Table("MainBodyPlaceholder_MainBodyPlaceholder_RFX_myRFxGrid").Cell(0, 0).Table("MainBodyPlaceholder_MainBodyPlaceholder_RFX_myRFxGrid_DXMainTable").Cell(3, 1).Link(0).Click();

  page.Wait();



This doesn't(table object doesn't found):

var page;

  iexplore = Sys.Process("iexplore", 2);

  iexplore.ToUrl("http://...");

  page = iexplore.Page("http://...");

var PropArray = new Array("Name", "VisibleOnScreen");

var ValuesArray = new Array("*RFX_myRFxGrid_DXMainTable*", true); 

var RFx_table = page.FindChild(PropArray, ValuesArray,1000);

RFx_table.Cell(3,1).Link(0).Click();



Why?



Thx a lot

  • vibe's avatar
    vibe
    Occasional Contributor
    It is work using page.Find method and NativeWebObject.id property
  • Hi,



    VisibleOnScreen can be a problem in your original case. The value of this property depends on whether the target object is currently drawn on the screen (not covered by any other objects), which can be unreliable. If you need to find a visible (not hidden) object, use Visible instead.



    In any case, using NativeWebObject.id is the most reliable way to find objects because this property returns the object name assigned to it in the HTML code.