Java ର RemoteWebDriver କମାଣ୍ଡଗୁଡ଼ିକ ପ୍ରକ୍ସି ଦ୍ୱାରା ପଠାନ୍ତୁ
Java ପ୍ରୋଗ୍ରାମ୍କୁ ଫରୱାର୍ଡ ପ୍ରକ୍ସି ଦ୍ୱାରା ଦୂରସ୍ଥ WebDriver ସେବାରେ ପହଞ୍ଚିବା ଦରକାର ହେଲେ command executor ରେ ClientConfig ଗଠନ କରନ୍ତୁ।
Java runner → configured proxy → WebDriver service
remote browser → its own route → website
ପ୍ରଥମ ପଥ ପାଇଁ Java command executor ଗଠନ କରନ୍ତୁ:
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URI;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.HttpCommandExecutor;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.remote.http.ClientConfig;
var proxy = new Proxy(Proxy.Type.HTTP,
new InetSocketAddress("proxy.example", 8080));
var config = ClientConfig.defaultConfig()
.baseUri(URI.create("https://grid.example/"))
.proxy(proxy);
var executor = new HttpCommandExecutor(config);
var driver = new RemoteWebDriver(executor, new ChromeOptions());
ତାହାର deployment ପଥ ସହିତ ପ୍ରକୃତ Grid endpoint ବ୍ୟବହାର କରନ୍ତୁ। ଆବଶ୍ୟକ Chrome ବିକଳ୍ପ ରଖନ୍ତୁ ଏବଂ driver.quit() ଦ୍ୱାରା ସେସନ୍ ସମାପ୍ତ କରନ୍ତୁ।
ଏହା Java ପ୍ରୋଗ୍ରାମ୍ର HTTP ସଂଯୋଗ ପାଇଁ java.net.Proxy ଅଟେ। ଅନ୍ୟପଟେ Selenium ର org.openqa.selenium.Proxy capability ବ୍ରାଉଜର୍ ପୃଷ୍ଠା ଟ୍ରାଫିକ୍ ନିୟନ୍ତ୍ରଣ କରେ; ଦ୍ୱିତୀୟ ପଥରେ ମଧ୍ୟ ପ୍ରକ୍ସି ଦରକାର ହେଲେ ତାହାକୁ ଅତିରିକ୍ତ ଭାବେ ବ୍ୟବହାର କରନ୍ତୁ।
ସେସନ୍ ସୃଷ୍ଟି କିମ୍ବା କମାଣ୍ଡ ପଠାଇବା ବିଫଳତା ପ୍ରଥମ ପଥରେ ପଡ଼େ। ପରବର୍ତ୍ତୀ ନେଭିଗେସନ୍ ଦ୍ୱିତୀୟରେ ବିଫଳ ହୋଇପାରେ। Java ପ୍ରୋଗ୍ରାମ୍ର ମଧ୍ୟସ୍ଥରେ ପ୍ରମାଣୀକରଣ ପାଇଁ ସେହି HTTP ପରିବହନ ସମର୍ଥିତ ପଦ୍ଧତି ଦରକାର; ବ୍ରାଉଜର୍ ପ୍ରମାଣୀକରଣ callback ତାହା ଗଠନ କରେ ନାହିଁ।