Forum Discussion

marroth_ds's avatar
marroth_ds
Occasional Contributor
12 years ago

Chrome can't find any object

Hi,

I have a script which works on IE and Firefox, however when I do the same script using Chrome I can't find any element with the FindChild() method. The script worked before, so I don't know why it's no longer finding it. This is basically the code which is to be executed (I've omitted the function calls, validating and such):



var env = ODT.Classes.Environment;

  env.m_browser = -3; //set the browser to chrome

 

  //launches the specified browser and opens the specified URL in it.

  Browsers.Item(env.m_browser).Run();



//go to the login page

  Browsers.CurrentBrowser.Navigate(env.m_environmentLink);



//set user name

Aliases.browser.FindChild("idStr", "user", 9999).SetText("myuser");

...



It starts chrome, it goes to the page and...

It fails on the last one with the error message: "You are trying to call the "SetText" method or property of an object that does not exist."



Once again, this script works on both IE and Firefox (so there is nothing wrong with the parameters). I've the latest Chrome patch (32 for TC10) and im using TestComplete10 (ver 10.0.531.7)



I think that I did this piece of code before it all became like this for chrome (not sure if it's connected):

Aliases.browser.FindChild("ObjectType", "Page", 0).Refresh();



Any help as to what could be the cause or how to approach this?

10 Replies

  • marroth_ds's avatar
    marroth_ds
    Occasional Contributor
    I found the problem, apparently Chrome won't find any objects unless the Run() method has a parameter. This fixed the problem:

    ...

    Browsers.Item(env.m_browser).Run(env.m_environmentLink);

    ...



    But why? :/
  • marroth_ds's avatar
    marroth_ds
    Occasional Contributor
    Me again.. This is becoming a monologue, I guess.

    I have noticed that chrome didn't work properly when it started up, but when I didn't launch the browser with smartbear it would work. It would complete the first page (there was no clicks used) but on the next page it would log that it filled in the fields correctly but it didn't so the test failed.



    As far as i can tell the problem here was that chrome doesn't have the correct focus, when it's launched. So I had to do a Click somewhere on the page to get the correct focus before I continued the test.



    I hope this helps someone other than me and/or that smartbear notice this and fixes this in the next patch
  • AlexKaras's avatar
    AlexKaras
    Community Hero
    > Tanya Gorbunova: Could you please check what Chrome version is installed on your computer?



    >> Martin Svanström: I've the latest Chrome patch (32 for TC10) and im using TestComplete10 (ver 10.0.531.7)

  • Hi,


     


    Thanks for the correction Alexei - didn't notice this indeed.


     


    Martin, check the value of the Web page loading timeout project option. This option identifies how long TestComplete will wait until the specified page in the Navigate method is fully loaded. Another way is to try specifying the second PageLoadWaitTime parameter using the Run or Navigate method.


     

  • marroth_ds's avatar
    marroth_ds
    Occasional Contributor
    @Tanya: it doesn't matter how long I wait, the problem is not the time (it's the focus, as a click resolved this issue). The problem is that chrome will say that it finds the objects, and fills them with the correct data but in reality it doesn't fill the data.

    It worked on the first screen, but unless you use a click at some point during the first screen before going to the next one this explained scenario will happen.

  • oatadjanov's avatar
    oatadjanov
    New Contributor
    I have very similar experience. Haven't resolved it. But it's definately focus. Using Chrome version 37. It worked on one laptop just fine, but is not working well at all on the other one.



    It seems that object finder tool can't get correct border.



    TC version 10.30.1303.7



  • mdh's avatar
    mdh
    Contributor
    ... even worse on 10.40.2015 w. Chrome v37 - the spy can not anymore find objects which was working with 10.30 (all chrome patches installed).



    even this command do not work anymore.... (works on IE)



    Call Browsers.Item(btChrome).Run(homepage,PageLoadWaitTime)



    PageLoadWaitTime are in this case 60000
  • Hi,

     


    @Bek, I've replied to you in another thread here.


     


     


    @Morten, could you please install TestComplete 10.40.2018? It should be available in your SmartBear Account.


    BTW, there is no need to install any additional patches. Chrome 37 should be supported by default. So, please delete them.