Maximo

Maximo

Come for answers, stay for best practices. All we're missing is you.

 View Only

IBM Selenium Recorder Setup 

Thu March 26, 2020 03:59 PM

Forum question posted - 

Hi,

Everything with Eclipse and TestNG is working great, I was able to run the setup.bin file. However I am having issues getting the Recorder to execute.
My issue is with setting up the Bookmarklet in chrome. When I click on the bookmark in Chrome we get the following error:
Uncaught ReferenceError: require is not defined
I have modified TpaeInspector.js with my http path.
Then I have setup the Bookmarklet with my http path as well.
I have an http link that I believe works, I can reach the js file when pasting the URL in a browser.
Any help would be appreciated.
Jerade



Response -

1)

Hi Jerade.


What does the bookmark look like? On our machines, the bookmark looks like the following:

javascript: void(require(["https:/path to file/TpaeInspector.js"], function(inspector){new inspector().startup(/*headless*/false, "https://path to file/TpaeInspector.js")}));

Can you verify that yours looks the same? And do you have this set up on a file server where you can reach the files?

 

Thanks,

Kristin

2)

Hi Kristin,

Thanks for the response, here is my Bookmark code:

javascript: void(require(["http://maxdev3:8700/doclinks/RecorderTest/TpaeInspector.js"], function(inspector){new inspector().startup(/*headless*/false, "http://maxdev3:8700/doclinks/RecorderTest/TpaeInspector.js")}));

If I paste "http://maxdev3:8700/doclinks/RecorderTest/TpaeInspector.js" into my browser it shows me the js code.

So I think I have access to the js file through the URL. Obviously something is still not right.

Jerade

3)

Hi Jerade.

Is that file location able to serve back javascript? The files need to be located on an http server that can serve back javascript for the recorder.

Being able to reach the files through the browser just means that they're located in the location you are passing in.

Thanks,

Kristin

4)

Hi Kristin,

 When I followed the above steps to configure in chrome browser , it is not opening the recorder setup and when saw in developer console(F12),

 it shows the error : uncaught ReferenceError: require is not defined 

 I did the following to run the recorder portion of the Selenium framework, I have placed the recorder files in tomcat server location so that it is accessible through link ,
  below are two files

 1. http://localhost:9999/recorder/TpaeInspector.js
 2. http://localhost:9999/recorder/Inspector.js.

 On line no. 32 in TpaeInspector.js. , added the link to the file as below:
    http://localhost:9999/recorder/Inspector.js  

My browser scriplet text :  

javascript: void(require(["http://localhost:9999/recorder/TpaeInspector.js"], function(inspector){new inspector().startup(/*headless*/false, "http://localhost:9999/recorder/TpaeInspector.js")}));

Any help would be appreciated..!!

5)

I Tried another workaround to run the recorder setup .. Since it uses DOJO Api in TpaeInspector.js and Inspector.js.. So Simply created dojo.html file which includes the  dojo api because it uses methods such as require , define , decalre and so on .. see html file below : 

<html>
<head>
   <script>dojoConfig = {parseOnLoad: true}</script>
    <script src='http://localhost:9999/js/dojo/dojo.js'></script>
    <script src='http://localhost:9999/js/TpaeInspector.js'></script>
    <script src='http://localhost:9999/js/Inspector.js'></script>
    
    <script type="text/javascript"  charset="utf-8">
    function handleClick()
{    
require(["http://localhost:9999/js/TpaeInspector.js"], function(inspector){new inspector().startup(/*headless*/false,"http://localhost:9999/js/TpaeInspector.js"

)});}    
</script>
</head>
<body onload="handleClick()">
</body>
</html>

The above html file is able to run the recorder setup but bounded only to dojo.html page and when tried to navigate Maximo login page it goes off , since the widget is not running independently and the browser bookmarklet doesn't support the require function directly.

Kindly assist to run the recorder setup. 


6)

Are you logged into Maximo when trying to launch the recorder? It will only work once you are logged into Maximo. If I try to launch when not logged in, I receive the same error.

 

Thanks,

Kristin

7)

Hi Kristin,

I resolved the issue and the recorder is working now.

Thanks for you assistance. Smile 

8)

Hi bison01,

I have issues with configuring the file location in TpaeInspector.js and Inspector.js. Can you let us know how this issue is resolved for you. Also what is the path location you mentioned in the TpaeInspector.js. Any help would be appreciated.

9)

What problems are you having? The problems above were related to trying to open the recorder before logging into Maximo. The recorder is only supported once logged in.

 

Thanks,

Kristin

10)

I was referring to the document Maximo Automation Using Selenium.docx -> Selenium Recorder Setup 

I did the following for the below points

2.    Copy Inspector.js and TpaeInspector.js to a central location. ---> I copied these files to shared/central location (//maxdevserver/ibm/recorder/TpaeInspector.js ,  //maxdevserver/ibm/recorder/Inspector.js )
3.    Open TpaeInspector.js. On line 32, change the location of the Inspector.js to the location where it was just copied  --> "https://location_of_inspector/Inspector.js" --> How should I specify the location of the inspector file here ? I dont have a https link but a shared windows path is what I have.

 

 

Also how should I configure/specify the scriplet text, below with the shared path in the URL ?

javascript: void(require(["https://<InspectorLocation>/TpaeInspector.js"], function(inspector){new inspector().startup(/*headless*/false, "https://<InspectorLocation>/TpaeInspector.js")}));

 

Thanks Kristin for your response. Hope you got my questions.

11)

The files need to be located on an http server that can serve back javascript for the recorder. There is an updated document (as well as updated framework) with this information. 

Please put the files on an http server and retry.

 

Thanks,

Kristin

12)

Thanks Kristin,

Issue is resolved now.

13)

Good day Kristin,

Im having a similar problem to that of Jerade. Right now, I am thinking it is because my http server cannot serve back javascript. Im using Apache.

Would you happen to know how I may be able to check this? In the config file maybe.

 

Hope to hear from you.

Thanks,

Enrique

14)

Kristin, Jerade,

I realize, it's been almost 2 years since Jerade asked this question about Recorder set up, but I have the same problem with Recorder - it won't run. I noticed Jerade placed TpaeInspector.js into doclinks directory http://maxdev3:8700/doclinks/RecorderTest/TpaeInspector.js - where HTTP server is already configured and running. I did the same thing .. thinking that HTTP server is already running as part of Maximo and serving attachments. I also made a change to Maximo system property "mxe.doclink.doctypes.allowedFileExtensions" and added "js" (JavaScript extension) as allowed extension. My Maximo and HTTP servers are running and I can view attachments. However, when I tried to go to the Recorder's bookmark, the server doesn't execute JavaScript but shows TpaeInspector.js file code. 

Can you please advise, what shall I change for the Recorder to run?

Thank you,

Galina Leonova.

15)

Hi Galina.

 

What does the bookmark look like, and did you change the line in the TpaeInspector to point to the correct location where the Inspector is located? And are you trying to launch the recorder after being logged into Maximo? 

 

Thanks,

Kristin

16)

Hello Kristin,

thank you for your quick reply! Here is the answers to your question.

1. The bookmark is javascript: void(require(["http://fams.dev.blm.doi.net:8080/Selenium/TpaeInspector.js"], function(inspector){new inspector().startup(/*headless*/false, "http://fams.dev.blm.doi.net:8080/Selenium/TpaeInspector.js")}));

2. Yes, I change line 32 in TpaeInspector.js to point to Inspector.js. In my case it's  "http://fams.dev.blm.doi.net:8080/Selenium/Inspector.js"

3. Yes, I click on bookmark after I logged into Maximo.

My Maximo server is running on https://fams.dev.blm.doi.net/maximo . I places both TpaeInspector.js and Inspector.js into doclinks subdirectory ( Maximo directory for attachments). Because WebSphere is already running HTTP server that specifically configured to serve Maximo attachments, I though I can use it to Recorder files as well.

Is there any limitation /problems to use doclinks server for Recorder? Have anybody implement it before?

Thank you,

Galina.

17)

Hi Galina.

I don't know how people have implemented the recorder in their environments.

 

After you try to launch the recorder, are there any errors in the developer console?  That would help to figure out what the problem could be.

 

Thanks, 

Kristin

18)

Hello Kristin.

First of all - I made IBM Selenium Recorder to come up! Finally! I did not create or build another HTTP server. Instead, I use IBM HTTP server that WebSphere  is already running for Maximo attachments ( doclinks). Here is my steps:

1. Check that Maximo doclinks is configured according to this  https://www-01.ibm.com/support/docview.wss?uid=swg21312993 or here http://maximodev.blogspot.com/2014/06/attachments-doclinks-configuration.html

2. You  need to know these  Maximo System Properties

mxe.doclink.doctypes.defpath = [DOCLINKSDIR]
mxe.doclink.path01 = [DOCLINKSDIR] = http://[MXHOSTNAME]

to use in steps 3-6

3.On physical server where attachment files are stored, add "Selenium" sub-directory to [DOCLINKSDIR].

4. Place both TpaeInspector.js and Inspector.js into "Selenium" directory.

5. Edit TpaeInspector.js  file and change  line 32 in to point to Inspector.js as http://[MXHOSTNAME]/Selenium/Inspector.js

6. Create "Selenium Recorder" bookmark as

javascript: void(require(["http://[MXHOSTNAME]/Selenium/TpaeInspector.js"], function(inspector){new inspector().startup(/*headless*/false, "http://[MXHOSTNAME]/Selenium/TpaeInspector.js")}));

7. Bounce HTTP server ( either via WAS console or via Windows Service terminal if you are in Windows environment)

8. Login into Maximo.

9. Click on "Selenium Recorder" bookmark. At first, nothing will happen, but you shall see warning "shield" with red asterisk just after URL string ( see screenshot below). Click on this warning. In pop-up window you'll see:

 

Insecure content blocked

Click on "Load unsafe script"

10. Click on "Load unsafe script"and Recorder will pop-up. Or you might need to click on "Selenium Recorder" bookmark one more time.

I'm glad I was able to utilize existing Maximo infrastructure to make Recorder to work. Hope it'll help other developers.

Thank you,

Galina Leonova.

19)

Hi Galina.

 

That's great news that you were able to get it to work? Hopefully the steps you provided will help anyone that runs into this same problem.

 

I'm going to make a note of these steps and include them in updated documentation if it's okay with you.

 

Thanks, 

Kristin

20)

Hi Kristin,

if you can, please  try to reproduce my steps in your Maximo environment doclinks set up. If it works, feel free to include them with recorder updated documentation -it's 100% OK with me.

Thanks,

Galina Leonova.





#MaximoEAM
#Maximo
#AssetandFacilitiesManagement

Statistics
0 Favorited
8 Views
0 Files
0 Shares
0 Downloads