1

I'm developing a web app (in Spring Boot) that would need to simplify the user interaction with other websites (third party, not developed by me). The idea is that my app pre-fill a form so the user won't have to do it.

As I began to read about this I stumble upon HtmlUnit and then Selenium... I tried Selenium and I was very happy while I was developing because I manage to open a browser window and fill it as I want it.

Then I thought it would be a good idea to test it from another computer in the same LAN. So open up a browser, navigate to my ip:port and when I hit the button that should perform the automation described, the browser open up on my "server" machine where the app is running and not on the client.

It was very frustrating. Keep reading and I found something about Selenium Hub and Grid. I've read several articles about it but it confuses me because they are all oriented at performing tests and I don't even understand where should I start or if it even possible.

What I want is to have my web-app installed in a Ubuntu Server and any client could access it and when hitting a button open a web page in a specific URL and pre-fill the form data.

Can you guide me? I'm in the correct path with Selenium Grid and Hub or there's any other technology I should be using?

sebasira
  • 1,739
  • 1
  • 22
  • 41
  • What you're asking is not possible for various reasons. The client (speak: the user of your website) would need to be the one running Selenium so that it fills in their browser. Otherwise you'd be filling the form in a browser session that only runs on your server, which you can't pass back to your client. That sort of thing also wouldn't scale at all. An alternative would be Javascript, but then you'd run into security issues (XSS, CORS, et al) – Thomas Timbul Dec 04 '19 at 14:53
  • What might work is to treat with each of the third party website owners, and get them to make it possible to direct users to their form, to which you can pass the relevant parameters as part of the request to have the form pre-populated. e.g. you generate a link to `http://thirdparty/form?name=Test&lastname=User` to have the 'name' and 'lastname' fields populated accordingly. – Thomas Timbul Dec 04 '19 at 14:58
  • Thank you all for your comments! I think I will need to give up on this idea and ask the user to fill it up – sebasira Dec 04 '19 at 15:41
  • If i got your problem right have a look at WETATOR (www.wetator.org). This is a test tool base on HtmlUnit that does something similar. It takes a really simple input (a table with commands) and automates a web page in the back. The source is public. – RBRi Dec 04 '19 at 16:21
  • You want your app to open a browser and interact with it? Or open a browser within your app? – DMart Dec 04 '19 at 18:04
  • @RBRi can you elaborate on how I can use it? – sebasira Dec 04 '19 at 20:00
  • @DMart the user already has a browser open because it's using my web app. I want to open a new browser window or tab, navigate to an URL and fill input tags of a form (present in that page) with text from my app. – sebasira Dec 04 '19 at 20:02
  • I don't think what you're suggesting is doable. Not from within a webapp. You can certainly open a new window with a form. Maybe within an iframe, but I'm not sure you can send javascript to that window to prepopulate, only if that form takes parameters in the request url. – DMart Dec 04 '19 at 21:00
  • I'm also getting to the point that it is not doable... But I've not surrender yet, I've already done it opening the URL in a WebView in an Android app, so maybe there's a light at the end of the tunnel – sebasira Dec 04 '19 at 23:08
  • @sebasira New browser or window will be open on server side. – hrdkisback Jan 24 '20 at 06:35

0 Answers0