8 Replies Latest reply on Aug 20, 2014 2:24 PM by Vasanth Kumar S M-Oracle

    A couple of doubts about OpenScript

    2703167

      Hello everyone, excuse my lack of experience working on these kind of projects, I have been working with them for a couple of months, but a couple of issues have appeared since I started using Oracle Test Manager and Openscript.

       

      First off, I'd like to know if it's possible to set the focus on the browser executing test or maximize the window. As it is, the automated tests will suddenly lose focus on the browser which will cause some issues when using commands like pressEnter() or would fail because elements aren't within the default size of the window, so I wanted to ask if there is a way to set focus within the code or somewhere around the preferences that I haven't found yet.

       

      Second I'm having this issue where I need to verify if the web site displays an alert dialog, but to do so I need to set the focus on a textBox (I do this by clicking the textBox), and then setting the focus somewhere else (once again, I click somewhere else). The alert message does appear, which means the click does happen, but it isn't registered within the script, which means it crashes with a Find Object Timeout after a while instead of going through the steps of the test. I wanted to know if this could be an issue with Openscript or if it's something happening on the site.

       

      I'm very sorry if this isn't enough information to let you guys help me, but I will do my best to share all that's needed.

        • 1. Re: A couple of doubts about OpenScript
          Manish Bhatla-Oracle

          no direct method to set the focus on the Web browser window.

           

          we use following two command/alternate method to set the focus on the window

          web.window(XPath).minimize();

          web.window( XPath).maximize();

          1 person found this helpful
          • 2. Re: A couple of doubts about OpenScript
            Srinivas Potnuru-Oracle

            Could you please elaborate on "The alert message does appear, which means the click does happen, but it isn't registered within the script"

            • 3. Re: A couple of doubts about OpenScript
              2703167

              Well, I'll try to explain this with steps:

               

              1. Click TextBox A to set focus on it

              2. Write something
              3. Click TextBox B

              4. An alert dialog appears

              5. Click ok on alert dialog

               

              The alert dialog only appears when you follow these 4 steps, and in execution the script would work just fine all the way until this point. After filling the TextBoxA and doing the click, the alert dialog would appear, but for some reason the script stays stuck at the third step trying to find the object TextBox B while the alert dialog is on screen. Since it can't manage to find it with the alert on, it fails.

              • 4. Re: A couple of doubts about OpenScript
                Srinivas Potnuru-Oracle

                Would it be possible to share the code which was used for this scenario.. would like to see if needs some modifications and can solve.

                • 5. Re: A couple of doubts about OpenScript
                  2703167

                  I'm afraid that due to company policies I'm unable to share the whole code, but I can share the contents of the group where the error happens

                   

                    {

                    web.textBox(

                    57,

                    "/web:window[@index='0' or @title='{{site}}?_adf.ctrl-state=70ssy5qil_7']/web:document[@index='0' or @name='70ssy5qil_1']/web:form[@id='f1' or @name='f1' or @index='0']/web:input_text[@id='pt1:it1::content' or @name='pt1:it1' or @index='0']")

                    .click();

                    {

                    think(2.255);

                    }

                    web.textBox(

                    58,

                    "/web:window[@index='0' or @title='{{site}}?_adf.ctrl-state=70ssy5qil_7']/web:document[@index='0' or @name='70ssy5qil_1']/web:form[@id='f1' or @name='f1' or @index='0']/web:input_text[@id='pt1:it1::content' or @name='pt1:it1' or @index='0']")

                    .setText("{{LOCALIDAD COMODIN}}");

                    {

                    think(2.547);

                    }

                    web.textBox(

                    59,

                    "/web:window[@index='0' or @title='{{site}}?_adf.ctrl-state=70ssy5qil_7']/web:document[@index='0' or @name='70ssy5qil_1']/web:form[@id='f1' or @name='f1' or @index='0']/web:input_text[@id='pt1:it3::content' or @name='pt1:it3' or @index='1']")

                    .click();

                    {

                    think(0.934);

                    }

                   

                  /****************************/

                  //the alertDialog appears here, all code after this isn't executed

                  /***************************/

                   

                    System.out.println("Hello world");

                    web.alertDialog(

                    98,

                    "/web:dialog_alert[@text='{{alert}}' and @index='0']")

                    .clickOk();

                    }

                  • 6. Re: A couple of doubts about OpenScript
                    Srinivas Potnuru-Oracle

                    Hi,

                     

                    No problem, this part of the code should be enough .. and just want to confirm the script is failing @

                     

                    web.textBox(

                      59,

                      "/web:window[@index='0' or @title='{{site}}?_adf.ctrl-state=70ssy5qil_7']/web:document[@index='0' or @name='70ssy5qil_1']/web:form[@id='f1' or @name='f1' or @index='0']/web:input_text[@id='pt1:it3::content' or @name='pt1:it3' or @index='1']")

                      .click();

                      {

                      think(0.934);

                      }

                     

                     

                    or @

                     

                    System.out.println("Hello world");

                      web.alertDialog(

                      98,

                      "/web:dialog_alert[@text='{{alert}}' and @index='0']")

                      .clickOk();

                      }

                     

                    It would be great if you can share the console content which has the complete log of the execution and error details.

                    • 7. Re: A couple of doubts about OpenScript
                      2703167

                      The script itself fails at the click (first part you mentioned) with a Timeout, but it is weird since the error happens after we see the browser doing the click on the other textBox, which activates de alertDialog.

                       

                      Console content:

                       

                      10:41:34,037 ERROR [1] Error in section Run at line (script.java:191). Timeout(60 seconds) occurred waiting for page to load.

                      oracle.oats.scripting.modules.webdom.common.api.exception.WaitForPageTimeoutException: Timeout(60 seconds) occurred waiting for page to load.

                        at oracle.oats.scripting.modules.webdom.common.api.exception.WaitForPageTimeoutException.createWaitForPageTimeoutException(WaitForPageTimeoutException.java:34)

                        at oracle.oats.scripting.modules.webdom.common.api.internal.communication.MessageHandler.sendMessage(MessageHandler.java:98)

                        at oracle.oats.scripting.modules.webdom.api.internal.InternalWebDOMService.sendMessage(InternalWebDOMService.java:290)

                        at oracle.oats.scripting.modules.webdom.api.elements.DOMTestObject.runCommand(DOMTestObject.java:113)

                        at oracle.oats.scripting.modules.webdom.api.elements.DOMElement.focus(DOMElement.java:453)

                        at oracle.oats.scripting.modules.webdom.api.elements.DOMElement.click(DOMElement.java:246)

                        at script.run(script.java:191)

                        at oracle.oats.scripting.modules.basic.api.IteratingVUser.run(IteratingVUser.java:350)

                        at oracle.oats.scripting.modules.basic.api.internal.IteratingAgent.run(IteratingAgent.java:788)

                        at java.lang.Thread.run(Thread.java:619)

                      10:41:34,174 ERROR [1] Iteration 1 failed at line (script.java:191). Timeout(60 seconds) occurred waiting for page to load.

                      oracle.oats.scripting.modules.webdom.common.api.exception.WaitForPageTimeoutException: Timeout(60 seconds) occurred waiting for page to load.

                        at oracle.oats.scripting.modules.webdom.common.api.exception.WaitForPageTimeoutException.createWaitForPageTimeoutException(WaitForPageTimeoutException.java:34)

                        at oracle.oats.scripting.modules.webdom.common.api.internal.communication.MessageHandler.sendMessage(MessageHandler.java:98)

                        at oracle.oats.scripting.modules.webdom.api.internal.InternalWebDOMService.sendMessage(InternalWebDOMService.java:290)

                        at oracle.oats.scripting.modules.webdom.api.elements.DOMTestObject.runCommand(DOMTestObject.java:113)

                        at oracle.oats.scripting.modules.webdom.api.elements.DOMElement.focus(DOMElement.java:453)

                        at oracle.oats.scripting.modules.webdom.api.elements.DOMElement.click(DOMElement.java:246)

                        at script.run(script.java:191)

                        at oracle.oats.scripting.modules.basic.api.IteratingVUser.run(IteratingVUser.java:350)

                        at oracle.oats.scripting.modules.basic.api.internal.IteratingAgent.run(IteratingAgent.java:788)

                        at java.lang.Thread.run(Thread.java:619)

                      10:41:34,270 WARN  [BytesReportSender] Report sender callback was not initialized.

                      10:42:34,608 ERROR [EnumSrvc] Failed to get children by tag:window

                      oracle.oats.scripting.modules.webdom.common.api.exception.WaitForPageTimeoutException: Timeout(60 seconds) occurred waiting for page to load.

                        at oracle.oats.scripting.modules.webdom.common.api.exception.WaitForPageTimeoutException.createWaitForPageTimeoutException(WaitForPageTimeoutException.java:34)

                        at oracle.oats.scripting.modules.webdom.common.api.internal.communication.MessageHandler.sendMessage(MessageHandler.java:98)

                        at oracle.oats.scripting.modules.webdom.api.internal.InternalWebDOMService.sendMessage(InternalWebDOMService.java:290)

                        at oracle.oats.scripting.modules.webdom.api.internal.service.EnumSrvc.getChildrenByTag(EnumSrvc.java:191)

                        at oracle.oats.scripting.modules.webdom.api.internal.service.EnumSrvc.getChild(EnumSrvc.java:128)

                        at oracle.oats.scripting.modules.webdom.api.internal.service.EnumSrvc.getChildren(EnumSrvc.java:268)

                        at oracle.oats.scripting.modules.webdom.api.internal.service.EnumSrvc.getChildren(EnumSrvc.java:1)

                        at oracle.oats.scripting.modules.functionalTest.api.internal.services.FindTestObjectSrvc.findTestObject(FindTestObjectSrvc.java:131)

                        at oracle.oats.scripting.modules.functionalTest.api.internal.services.FindTestObjectSrvc.findTestObject(FindTestObjectSrvc.java:75)

                        at oracle.oats.scripting.modules.functionalTest.api.internal.services.FuncTestSrvc.findTestObject(FuncTestSrvc.java:72)

                        at oracle.oats.scripting.modules.functionalTest.api.internal.services.FuncTestSrvc.findTestObject(FuncTestSrvc.java:66)

                        at oracle.oats.scripting.modules.webdom.api.internal.InternalWebDOMService.findDomElementInMilliSeconds(InternalWebDOMService.java:873)

                        at oracle.oats.scripting.modules.webdom.api.internal.InternalWebDOMService.findDomElement(InternalWebDOMService.java:856)

                        at oracle.oats.scripting.modules.webdom.api.internal.InternalWebDOMService.findDomElement(InternalWebDOMService.java:848)

                        at oracle.oats.scripting.modules.webdom.api.elements.DOMTestObject.checkTestObject(DOMTestObject.java:175)

                        at oracle.oats.scripting.modules.webdom.api.elements.DOMBrowser.checkTestObject(DOMBrowser.java:89)

                        at oracle.oats.scripting.modules.webdom.api.elements.DOMBrowser.close(DOMBrowser.java:565)

                        at script.finish(script.java:376)

                        at oracle.oats.scripting.modules.basic.api.IteratingVUser.finish(IteratingVUser.java:450)

                        at oracle.oats.scripting.modules.basic.api.internal.IteratingAgent.doFinish(IteratingAgent.java:931)

                        at oracle.oats.scripting.modules.basic.api.internal.IteratingAgent.run(IteratingAgent.java:883)

                        at java.lang.Thread.run(Thread.java:619)

                      10:42:34,623 ERROR [1] Iteration 2 failed at line (script.java:376). Find Object timeout. Detail information:/web:window[@index='0' or @title='{{site}}?_adf.ctrl-state=70ssy5qil_7'].

                      oracle.oats.scripting.modules.webdom.common.api.exception.ObjectNotFoundException: Find Object timeout. Detail information:/web:window[@index='0' or @title='{{site}}?_adf.ctrl-state=70ssy5qil_7'].

                        at oracle.oats.scripting.modules.webdom.api.elements.DOMTestObject.checkTestObject(DOMTestObject.java:178)

                        at oracle.oats.scripting.modules.webdom.api.elements.DOMBrowser.checkTestObject(DOMBrowser.java:89)

                        at oracle.oats.scripting.modules.webdom.api.elements.DOMBrowser.close(DOMBrowser.java:565)

                        at script.finish(script.java:376)

                        at oracle.oats.scripting.modules.basic.api.IteratingVUser.finish(IteratingVUser.java:450)

                        at oracle.oats.scripting.modules.basic.api.internal.IteratingAgent.doFinish(IteratingAgent.java:931)

                        at oracle.oats.scripting.modules.basic.api.internal.IteratingAgent.run(IteratingAgent.java:883)

                        at java.lang.Thread.run(Thread.java:619)

                      10:42:34,855 ERROR [1] Error in section Finish at line (script.java:376). Find Object timeout. Detail information:/web:window[@index='0' or @title='{{site}}?_adf.ctrl-state=70ssy5qil_7'].

                      oracle.oats.scripting.modules.webdom.common.api.exception.ObjectNotFoundException: Find Object timeout. Detail information:/web:window[@index='0' or @title='{{site}}?_adf.ctrl-state=70ssy5qil_7'].

                        at oracle.oats.scripting.modules.webdom.api.elements.DOMTestObject.checkTestObject(DOMTestObject.java:178)

                        at oracle.oats.scripting.modules.webdom.api.elements.DOMBrowser.checkTestObject(DOMBrowser.java:89)

                        at oracle.oats.scripting.modules.webdom.api.elements.DOMBrowser.close(DOMBrowser.java:565)

                        at script.finish(script.java:376)

                        at oracle.oats.scripting.modules.basic.api.IteratingVUser.finish(IteratingVUser.java:450)

                        at oracle.oats.scripting.modules.basic.api.internal.IteratingAgent.doFinish(IteratingAgent.java:931)

                        at oracle.oats.scripting.modules.basic.api.internal.IteratingAgent.run(IteratingAgent.java:883)

                        at java.lang.Thread.run(Thread.java:619)

                      10:42:39,258 WARN  [BytesReportSender] Report sender callback was not initialized.

                      • 8. Re: A couple of doubts about OpenScript
                        Vasanth Kumar S M-Oracle

                        Hi,

                         

                        Can you please let us know if the website is loading the login page within 60 seconds? If not you can try this below method:

                         

                        I suggest you to increase playback timeout of web browser in settings.

                         

                        You can do this by navigating to menu "View --> Openscript Preferences..." and then select "Web Functional" under "Playback" from left side menu list.

                         

                        Then under "Object Timeout" textfield you can set maximum wait time as 90 or 120 as per your requirement so that openscript tool will wait maximum of 90 or 120 seconds till webpage opens.

                         

                        You can achieve this through code also by adding delay(in milliseconds) or by using while not condition.

                         

                        Thanks and Regards,

                        Vasanth Kumar S M