
Haya, this is still lingering? Solutions: 1. If the message reported is in a popup generated from alert() or a wrapper around alert() you can do the following var alertDlg = driver.switchTo().alert(); var text = alertDlg.getText(); text will now have the file name and you can strip the file name from there 2. If the message is generated from a <div> (Most likely), you can manual "Inspect Element" and get the id of the div and do it a couple of times more to make sure it is static. Then you can do this: var text = document.getElementById('idOfBox').innerHTML; Then again you can strip the file name out of text. Steve ----- Original Message ----- | From: "Bwana Lawi" <mail2lawi@gmail.com> | To: "Skunkworks forum" <skunkworks@lists.my.co.ke> | Sent: Domingo, 22 de Diciembre 2013 22:17:46 | Subject: [Skunkworks] Fwd: Javascript Question | Hi Joseph, | From your explanation, and several internet searches, it looks like | what I am looking for is not possible/doable :( | As I mentioned, this is a webapp running on jboss. All the user does | is click on an option. | For instance, a simple report showing list of countries: | Inline image 2 | When the user clicks on Print to Server, the request is sent back to | the reporting server and a physical file is created in a directory | on the server. Then the response below is sent to the user: | Inline image 4 | All I want is to access the COUNTRY.txt from js. Vanilla js, not | ajax. It's not possible to recreate the variables/parameters being | sent to the jboss server classes. NB: There are 2 servers at play | here: jboss (middleware) and the reporting server. | On Fri, Dec 20, 2013 at 9:05 PM, Joseph Wayodi < jwayodi@gmail.com > | wrote: | | Hey, | | | Let me assume that you're using AJAX, and not doing an actual form | | submit [1]. | | | First of all, we do not know all of what is returned when you send | | the | | | HTTP request. There seems to be a JavaScript function that is | | handling | | | the response, by only displaying "Report printed successfully: | | | abcd.txt" in the popup window. Did you write this function? And can | | | you modify it? If you can, then this is where you should put the | | code | | | to handle the response to do whatever you want, assuming the HTTP | | | response includes all the data you need. | | | For reference, check this out: | | | < https://developer.mozilla.org/en-US/docs/AJAX/Getting_Started >. | | | [1] < | | https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement.submit | | > | | | Joseph. | | | On Fri, Dec 20, 2013 at 3:59 PM, Bwana Lawi < mail2lawi@gmail.com > | | wrote: | | | > Thanks Steve, | | | > | | | > I am actually interested in the first part of your answer. The | | > use | | > of ajax | | | > to get the contents of the response. | | | > | | | > The response, in this case, "Report printed successfully: | | > abcd.txt" | | > comes as | | | > the body of the popup window. | | | > | | | > Meaning I somehow have to access that window and read the | | > content. | | | > Extracting the filename string is easy, dont worry about that | | | > | | | > | | | > _______________________________________________ | | | > skunkworks mailing list | | | > skunkworks@lists.my.co.ke | | | > ------------ | | | > List info, subscribe/unsubscribe | | | > http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks | | | > ------------ | | | > | | | > Skunkworks Rules | | | > http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 | | | > ------------ | | | > Other services @ http://my.co.ke | | | _______________________________________________ | | | skunkworks mailing list | | | skunkworks@lists.my.co.ke | | | ------------ | | | List info, subscribe/unsubscribe | | | http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks | | | ------------ | | | Skunkworks Rules | | | http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 | | | ------------ | | | Other services @ http://my.co..ke | | _______________________________________________ | skunkworks mailing list | skunkworks@lists.my.co.ke | ------------ | List info, subscribe/unsubscribe | http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks | ------------ | Skunkworks Rules | http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 | ------------ | Other services @ http://my.co.ke