Something tells me this library isn't going to be useful... [The Openscript/JDE Thread]
-
Long story short, Oracle.
Long story somewhat less short, I've opened up a library of functions used to put together sample scripts for testing a particular Oracle product in the hopes that the functions will be useful in my efforts to test the product now that it's been augmented with custom code and this is the first function I see:
-
Oh look, versioning!
See, here's version 1:
And version 2:
Version 3 must be current, because only large chunks of it are commented out, rather than the whole thing.
-
You know there's a different category this thread belonged in.
-
-
-
Ah - missed that bit.
-
What, the very first sentence? ;)
-
Yes. The very first sentence.
Did you have a point?
-
Toaster tells me I managed to keep busy on other projects for nine whole days >.>
Today's task: logging in.
Library:
/************************************************************************************************************ * Description: The StartE1 function will be used to start an EnterpriseOne session and log in. * This function will be a wrapper for other function calls, depending on how we decide to * start EnterpriseOne sessions. * Note: This function should be called at the beginning of every E1 automation script. * [Yami's note: Some documentation snipped] * ********************************************************************************************************** */ public void startE1() throws Exception { String sUser, sPassword,loginUserID; String [] arryStrng; int parts; parts = 0;sUser="";sPassword="";loginUserID=""; if (checkEOneSession()){ info("Good E1 Session Found"); loginUserID = getABNumber();// get the AB number with which the application is currently logged in try{ //Retrieving the user id and password from Login.ini file BufferedReader reader = new BufferedReader(new FileReader("C:/login.ini")); String line = null; line = reader.readLine(); if (line.equals("[ENVIRONMENT]")){ while ((line = reader.readLine()) != null) { //System.out.println(line); arryStrng = line.split("="); if (arryStrng[0].equalsIgnoreCase("user")) { //System.out.println(arryStrng[1]); sUser=arryStrng[1]; parts = parts+1; }else if (arryStrng[0].equalsIgnoreCase("password")) { //System.out.println(arryStrng[1]); sPassword=arryStrng[1]; parts = parts+1; } if (parts==2) { break; } } } reader.close(); } catch (IOException x) { setErrorRecovery(BasicErrorRecovery.ERR_FUNCTION_EXCEPTION, ErrorRecoveryAction.Fail); web.window("/web:window[@title='JD Edwards EnterpriseOne']").capturePage(); beginStep("[StartE1] Failed (Login Error.)", 0); { fail("Unable to Login. Login.ini might not exist"); }endStep(); getLogger().fatal("Login.ini might not exist. Please check and try again"); setErrorRecovery(BasicErrorRecovery.ERR_FUNCTION_EXCEPTION, ErrorRecoveryAction.ReportErrorAndContinue); } if (loginUserID.equalsIgnoreCase(sUser)){ //Check if logged in user id and userid in Login.ini file are same info("The Application is logged in with User ID provided in Login.ini"); }else{ logoutEOne(); if (!recoveryLogin(sUser,sPassword)) { setErrorRecovery(BasicErrorRecovery.ERR_FUNCTION_EXCEPTION, ErrorRecoveryAction.Fail); web.window(e1BrowserWindow).capturePage(); beginStep("[StartE1] Failed (Login Error.)", 0); { fail("Unable to Login. Check Login.ini or E1 Server may be down."); }endStep(); getLogger().error("StartE1 Login Failed. Check Login.ini or E1 Server may be down."); this.fail("Function recoveryLogin Failed. Exit Out"); setErrorRecovery(BasicErrorRecovery.ERR_FUNCTION_EXCEPTION, ErrorRecoveryAction.ReportErrorAndContinue); } } } else { info("Good E1 Session Not Found. Opening New Session"); logoutEOne(); if (!recoveryLogin("","")) { setErrorRecovery(BasicErrorRecovery.ERR_FUNCTION_EXCEPTION, ErrorRecoveryAction.Fail); web.window(e1BrowserWindow).capturePage(); beginStep("[StartE1] Failed (Login Error.)", 0); { fail("Unable to Login. Check Login.ini or E1 Server may be down."); }endStep(); getLogger().error("StartE1 Login Failed. Check Login.ini or E1 Server may be down."); fail("Function recoveryLogin Failed. Exit Out"); setErrorRecovery(BasicErrorRecovery.ERR_FUNCTION_EXCEPTION, ErrorRecoveryAction.ReportErrorAndContinue); } } }
- What's an AB number?
- Why are we reading the hardcoded path C:\login.ini?
- yay random java string parsing instead of moving that to another method
- Ok, so let's assume the first time I call this I'm not logged in... scrolling down... The error handling code is spectacularly readable here
- all IO exceptions are assumed to be file missing. Java has a specific exception for that, doesn't it?
- Ok, sol the point of this is to check what user we're logged in as. If we're already logged in as a user but not the right one we.... fail? oh no wait, we call a different function that logs us out, then a function that recovery logs us in, which is different than regular logging in because....?
- OK let's assume we don't have a good session, now that we're down at the part I care about, the first time login. We do a... recovery login... with no credentials. Why?!
This is a testing tool for functional testing, so it has record-and-playback capabilities. I recorded and played back a login sequence and got this lovely bit of code:
beginStep("[2] JD Edwards EnterpriseOne (/E1Menu.maf)", 0); { web.window(4, "/web:window[@index='0' or @title='about:blank']") .navigate("http://demojdeweb.[companyname].com/jde/E1Menu.maf"); web.window(5, "/web:window[@index='0' or @title='JD Edwards EnterpriseOne']") .waitForPage(null); { think(6.996); } web.textBox( 6, "/web:window[@index='0' or @title='JD Edwards EnterpriseOne']/web:document[@index='0']/web:form[@id='F1' or @name='F1' or @index='0']/web:input_text[@id='User' or @name='User' or @index='0']") .setText("[username]"); { think(0.022); } web.textBox( 7, "/web:window[@index='0' or @title='JD Edwards EnterpriseOne']/web:document[@index='0']/web:form[@id='F1' or @name='F1' or @index='0']/web:input_password[@id='Password' or @name='Password' or @index='0']") .setPassword(deobfuscate("[obfuscated password]")); { think(0.018); } web.textBox( 8, "/web:window[@index='0' or @title='JD Edwards EnterpriseOne']/web:document[@index='0']/web:form[@id='F1' or @name='F1' or @index='0']/web:input_text[@id='Environment' or @name='Environment' or @index='1']") .setText("[no idea if this is sensitive but redacted anyway]"); { think(0.023); } web.textBox( 9, "/web:window[@index='0' or @title='JD Edwards EnterpriseOne']/web:document[@index='0']/web:form[@id='F1' or @name='F1' or @index='0']/web:input_text[@id='Role' or @name='Role' or @index='2']") .setText("*ALL"); { think(0.927); } web.button( 10, "/web:window[@index='0' or @title='JD Edwards EnterpriseOne']/web:document[@index='0']/web:form[@id='F1' or @name='F1' or @index='0']/web:input_submit[@value='Sign In' or @index='0']") .click(); } endStep();
The form looks like this:
Where are those extra fields?! Oh. They're under the details button. I didn't set them, but it captured the default values and will try to set them anyway. That's useful. I think.
My custom code:
String loginForm = "/web:form[@id='F1' or @name='F1' or @index='0']"; String usernameTextbox = e1Browser + loginForm + "/web:input_text[@id='User' or @name='User']"; String passwordTextbox = e1Browser + loginForm + "/web:input_password[@id='Password' or @name='Password']"; String submitButton = e1Browser + loginForm + "/web:input_submit[@value='Sign In' or @index='0']"; web.window(4, "/web:window[@index='0' or @title='about:blank']").navigate("http://demojdeweb.[companyname].com/jde/E1Menu.maf"); web.window(e1BrowserWindow).waitForPage(null); web.textBox(usernameTextbox).setText("[username]"); web.textBox(passwordTextbox).setPassword(deobfuscate("[obfuscated password]")); web.button(submitButton).click();
Here's hoping it just works...
-
My favorite part?
-
Always launch without asking.
-
This is the most informative failure screenshot ever:
Thanks for screenshotting the wrong damn window. Real nice there. FFS.
-
For fox' sake, you have an entire fucking monitor to yourself, openscript, leave my Chrome alone!
What does it need, a whole damn VM to itself?
-
This works:
String logoutButton = e1BrowserWindow + "//web:a[@text='Sign Out']";
This doesn't:
String loginForm = "//web:form[@id='F1' or @name='F1' or @index='0']"; String usernameTextbox = e1BrowserWindow + loginForm + "/web:input_text[@id='User' or @name='User']";
This does:
String usernameTextbox = e1BrowserWindow + "//web:input_text[@id='User' or @name='User']";
Whatever.
-
Have I mentioned how useful the Javadoc is?
Compared to, say, Webdriver:
Which isnt' great either but at least there's information there.
-
What is 4, or was that documentation written by the underpants gnomes?
-
So I got a bit cocky. Having successfully logged in and out a handful of times, I now tried adding a fastpath navigation between login and logout.
An hour later, I'm still getting "object not found" issues. Also I had to reboot because OpenScript decided it couldn't find its VM, which is funny, because it must be talking about the JVM, if it was capable of running in a proper VM I'd be less irritated that it was hijacking my mouse while it runs and fucking up screenshots.
-
After about six hours fighting with OpenScript, I took a break for an hour and a half working on the Webdriver version for the side-by-side comparison.
I can log in, go to the fastpath, check the inventory levels, go to another fastpath and add inventory to a valid bin using the visual assist to determine what bins are valid, and then log out using Webdrviver.
This includes the fact that there's about fifteen nested tables for each layout, IDs are of the meaningless format "C0_15", and right-clicks in Chrome are hijacked for a custom menu making it hard to navigate through the page source. I hate JDE. This is still infinitely easier in webdriver.
-
But is it as open or scriptable???
-
Fuck you, Oracle. Just fuck you. I'm going home to hide from the blizzard.
(Fun fact: it did, in fact, return Null. Just under the second screenshot is a NumberFormatException from passing null to Integer.parseInt. It just also logged the exception to the console.)
-
The sum total documentation for the eone grid:
Dear oracle
die in a fireETA:
Even Google is stumped
-
I guess I should feel lucky that the only Oracle products I have to use are Oracle's Database and Java itself.
Or at least that will be true once we finish moving away from Oracle Application Server.
-
The sum total documentation for the eone grid:
You know, even just from the name — EnterpriseOneService API — my heart sinks. And I've never used it.
-
Oh, it's great. See, the product is JD Edwards Enterprise One, which is (AFAICT) the name Oracle assigned to the product formerly called JD Edwards when they bought up the company that made it. JDE is an ERP system, meaning it's basically Everything Enterprise Ever, and this tool, Oracle Application Testing Server, or OATS, is supposedly THE best way to test JDE. OpenScript is the bit of OATS that lets you write tests in Java using their super proprietary library that I can't make fucking work. Their paths are not xpath but some bastard knock-off xpath, their methods are undocumented, and their errors are all AbstractScriptErrors so you can't even debug.
-
Is it bad that I'm thinking that this makes SAP look good by comparison?
-
The best part? It's all a web interface. I'm trying to interact with fucking HTML controls. Literally, this enterpriseone grid I'm trying to get the cell contents for is a 4-level nested-table monstrosity with sporadic IDs such as "C_017" for a particular checkbox
-
JD Edwards when they bought up the company that made it. JDE is an ERP system
Ooohhhh....I've heard horror stories about that one. The company migrated from an IBM program (MAPICS, which I think is owned by someone else now) that actually did what they needed, to JDE, which didn't, but someone in a more rarefied office wanted for some reason.
That started several years ago, and I don't think they ever really got it working.
-
For shits and grins:
value = resultsGrid.cell(1,3).getValue()
Throws the same error as:
value = resultsGrid.getCellValue(1,3)
Ditto for
value = resultsGrid.cell(0,0).getValue()
So it's not the cell number.
-
Most versatile.
-
...and for
resultsGrid.clickCell(1,3)
I'm beginning to suspect the actual problem is in the eone.grid() function. Maybe my path is wrong.
ETA: Nope, I managed to get a different error for incorrect path.
-
System.out.println(resultsGrid.getColumnCount() x resultsGrid.getRowCount())
Output:40x0
WHAT. This table has 9 columns and 18 rows!
-
40x0
WHAT. This table has 9 columns and 18 rows!Well it sound like you found part of the reason you've been getting exceptions.
-
-
...... i know that screenshot from somewhere
-
Persona 4: Golden.
-
someone in a more rarefied office wanted for some reason.
I have seen these kinds of things happen too, and I have to assume gross corruption, kickbacks, the guy's family was kidnapped, something other than the alternative: A depressing level of incompetence and lack of fucks to give.
-
I have seen these kinds of things happen too, and I have to assume gross corruption, kickbacks, the guy's family was kidnapped, something other than the alternative: A depressing level of incompetence and lack of fucks to give.
I think it was just bog standard empire building. The particular cog in the giant Japanese corporation had managed to stay hidden for nearly 30 years, silently turning a profit (and winning world class accolades) in a line of business no one else in the company ever made money in. Some IT PHB sold someone else on standardizing stuff across a behemoth of a company and bureaucratic inertia just steamrolled common sense.
-
Output:
40x0
WHAT. This table has 9 columns and 18 rows!
I'm guessing that what you're addressing is not what you think you're addressing, perhaps because some POS intermediate layer you know nothing about has decided to insert (or remove) something in there without telling you. Or maybe it's decided to
send you down the wrong leg of the trousers of timea mysterious new copy just for S&Gs.
-
It's HTML! I can SEE the table! It's got a <table> tag and eighteen <tr> tags each with nine <td> tags inside them! Granted, it's all nested inside another table inside another table, inside a div inside a table, but the ID is on this particular table tag.
Which is not to say you're wrong, but that it makes no sense.
-
Granted, it's all nested inside another table inside another table, inside a div inside a table
Dear parser in heaven, is it using tables for layout?
-
Yes.
And tabular data.
And because it feels like it.
I suspect all this is to enable some WYSIWYG page editor on the backend. I've never seen the bits used to admin these pages, but everyone politely explains to me that JDE "isn't like those fancy things you have on the webteam" because you "just have to memorize the numbers, there's no names" and so on and so forth. So they talk about P5502s and "PY environment" (not "demo" or "testing", "PY", Oracle insisted!) and so on.
-
it makes no sense
-
I'm starting to hate the like button. I'd click it because it's there. But then again, I don't like it, I want to express my condolences.
-
-
Starting?
I usually find it useful in a sense of a "Thanks" button that some forums have. Or, in case of this forum, it's mostly a "+1" button. It cuts down on such replies when used properly.
Now, the fact that we abuse the hell out of it here... I don't find that surprising tbqh.
-
-
-
not the fox!
-
not the fox!
Hmm...I see that picture as the fox chasing the birds. The perspective is difficult, though, so I'd say it's appropriate in context of @Yamikuronue getting unexpected answers from Oracle.
-
Hmm...I see that picture as the fox chasing the birds.
huh.... never saw it that way before.... still have trouble flipping the perspective to make the fox chase the cranes... but you are right the perspective it pretty tight
and yes it is rather apropos to the situation @Yamikuronue faces. :-D