Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

getHost method on the session object for Selenium Grid #1541

Closed
lukeis opened this issue Mar 2, 2016 · 9 comments
Closed

getHost method on the session object for Selenium Grid #1541

lukeis opened this issue Mar 2, 2016 · 9 comments

Comments

@lukeis
Copy link
Member

lukeis commented Mar 2, 2016

Originally reported on Google Code with ID 1541

we make use of the session() in our Selenium Grid implementation, it would be useful
if a method can be exposed on this to get the host that binds to this particular session.

This will help us in performing some admin tasks before actually running the tests
on the machine. 

Reported by haroonzone on 2011-04-12 23:22:14

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Hello,
are you talking about grid1 or Grid2 ? What kind of admin task are you talking about
?

thanks
François

Reported by francois.reynaud on 2011-04-13 15:07:14

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

It would be good enhancement to Grid2, one of the task might be to change the DNS on
the machine to point to a certain environment. 

Reported by haroonzone on 2011-04-13 15:32:18

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Hello,
if I understand your requirement correctly, you should be able to do it with grid as
it is today by implementing the TestSessionListener


public class DNSChangeProxy extends WebDriverRemoteProxy implements TestSessionListener
{

    public DNSChangeProxy(RegistrationRequest request) {
        super(request);
    }


    @Override
    public void beforeSession(TestSession session) {
        super.beforeSession(session);

        // need to change the DNS on the host.
        URL nodeURL = session.getSlot().getProxy().getRemoteURL();
        String host = nodeURL.getHost();

        // ssh to host, do the DNS change. 
        // do some network validation.
        // 1) make sure the connectivity to the hub isn't impacted by the DNS change.
        // 2) take other tests into consideration. If 5 other tests are running on that node,
the DNS change will impact them too
    }

    @Override
    public void afterSession(TestSession session) {
        super.afterSession(session);
        // reset DNS.
    }

and when you register your node, -role webdriver -proxy com.company.DNSChangeProxy

Is it the kind of mechanism you need ?

thanks,
François

Reported by francois.reynaud on 2011-06-08 19:43:36

  • Status changed: Accepted
  • Labels added: Component-Grid

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Reported by francois.reynaud on 2011-06-08 19:45:18

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Hello,

in addition, you should be able to get the host  using the hub API.
/grid/api/testsession?session=your web driver session will give you a json object containing
some info about the session, including the url the node runs on.

Do you need something more than those 2 methods ?

thanks
françois

Reported by francois.reynaud on 2011-06-21 13:12:06

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

I think these two methods are more than enough now. I have not been able to
test/check these yet. Will do that and provide you with the feedback.

Reported by haroonzone on 2011-06-21 13:19:01

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

cool, closing then.
Create a new issue if you need a different way of accessing the hub internals.

thanks
François

Reported by francois.reynaud on 2011-06-21 13:26:34

  • Status changed: Fixed

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

How to get file downloaded path on remote machine(means node). Is any API for getting
that?

Reported by bdkakde on 2012-10-21 06:39:51

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Reported by luke.semerau on 2015-09-17 18:12:38

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this as completed Mar 2, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant