Selenium script for running a Batch File which will help to change the Browsers Proxy Settings

27 views
Skip to first unread message

Aniruddha

unread,
Jun 7, 2018, 6:08:22 AM6/7/18
to seleniu...@googlegroups.com
Hello Friends,

I need help from you guys on one of the tasks I have been assigned.

Make a script which will run a batch file and launch browser and help change the proxy setting of the browser, something like;

1. Execute Batch File
2. Launch Browser
3. Go to Lan Settings
4. change proxy settings.

Note: There should be a text file for inputting the servers and it should allow everything here.

Hope to get help from friends.

--
Thanks & Regards,

Aniruddha Malvi

Cassian Raja Thomas

unread,
Jun 7, 2018, 8:44:40 AM6/7/18
to seleniu...@googlegroups.com
You can write a power shell command to do that. In order to call PowerShell commands from your java code, just use JPowerShell. 

I found something like this to update settings of IE browser.

String command = "set-itemproperty -path "hkcu:Software\Microsoft\Windows\CurrentVersion\Internet Settings" -name ProxyServer -value "http=proxy-url:port;https=proxy-url:port;ftp=proxy-url:port;socks=proxy-url:port;" -type string";

powerShell = PowerShell.openSession();

//Print results    
System.out.println(powerShell.executeCommand(command).getCommandOutput());

powerShell.close();

Thanks & Regards,
Cassian Raja .T

--
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-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAFZDUkK%3Dg4nCxACC1%3DTctYHoChtsAG%3DOeg7JUWaV8AsDhiZ%2Bpw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages