How to get the User Home directory of node machine

107 views
Skip to first unread message

Sujay Naganagoudar

unread,
Jan 14, 2016, 4:57:42 AM1/14/16
to Selenium Users
Can anyone please let me know how to retrieve the USER home directory path of a remote machine (Node) where the selenium node is executing the tests.

Krishnan Mahadevan

unread,
Jan 14, 2016, 5:10:32 AM1/14/16
to Selenium Users
You can do it in the following way :

1. Build a new custom servlet which exposes a GET method which when called will return back the output of System.getProperty("user.home")
2. Inject the servlet built in step (1) into your node.
3. Once a new session has been created via the RemoteWebDriver, call getSessionId() to get the session id and use it to target the actual node to which the test was routed to, and invoke the servlet built in step (2)

How to build a custom servlet and inject it into the grid :

How to use a RemoteWebDriver's sessionId, query the grid and get the IP and port of the node to which your test was routed to :

The sample code in this gist post of mine should tell you how : https://gist.github.com/krmahadevan/1766772


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

On Thu, Jan 14, 2016 at 3:27 PM, Sujay Naganagoudar <suja...@gmail.com> wrote:
Can anyone please let me know how to retrieve the USER home directory path of a remote machine (Node) where the selenium node is executing the tests.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/ca7a13b6-b5a1-4090-a8b2-19a27aafedd5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

PeterJeffreyGale

unread,
Jan 14, 2016, 5:10:38 AM1/14/16
to Selenium Users
From previous comments that Krishnan has made on related topics, I think you would need to deploy a java sevlet into your app which could then get the info.

If you explain what you nerd it for, someone may be able to propose an easier solution.

Reply all
Reply to author
Forward
0 new messages