How can I set proxy to PhantomJs while run test?

390 views
Skip to first unread message

sreang rathanak

unread,
Sep 3, 2015, 11:22:03 PM9/3/15
to Selenium Users
Hi, everyone
Because of my web need to switch from one proxy to other proxy at the middle of runtime, now I have one problem when I try to change proxy on PhantomJS.
Which I cannot found any solution to help me solve this problem.
Do anyone know how to solve this problem?
I do googling nearly a week but got no solution.
Please Help Me.
:(

Krishnan Mahadevan

unread,
Sep 3, 2015, 11:24:34 PM9/3/15
to seleniu...@googlegroups.com
AFAIK, you cannot do it. Proxy can be bound to a browser [ driver object ] when it gets created. After that I don’t think it can be altered.


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/

--
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/183943a1-13d8-45be-8c27-24c7a1b83d44%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

sreang rathanak

unread,
Sep 3, 2015, 11:47:59 PM9/3/15
to Selenium Users
Thank,  do have any solution about it?, like use PAC file in it. I did try but I not work. It seem PhantomJS didn't support PAC file. 
Any idea or suggestion please.

Mark Collin

unread,
Sep 4, 2015, 6:43:59 AM9/4/15
to Selenium Users
Have a look at :


Sepecifically the following files:
in src/test/java/com/lazerycode/selenium/config

That shows how to set up the PhantomJS proxy.  You will not be able to switch the proxy in the middle of a test, to get PhantomJS running with a different proxy you'll need to create a new instance of it.  You can proxy through proxies though, the browsermob branch may be of use:


Again have a look at those two files in the branch.

sreang rathanak

unread,
Sep 7, 2015, 4:17:42 AM9/7/15
to Selenium Users
I try to research on browsermob, but I still not found the way which I can proxy through proxies.
Can you guide me on this? 
:)

Pvperz Sro

unread,
Oct 31, 2017, 2:51:00 AM10/31/17
to Selenium Users
did you find away ,if you know how to load pac file at phantom please tell me i have 1 motnhs searching and no thing :( 
Reply all
Reply to author
Forward
0 new messages