How to configure and setup HTMLUNIT with Selenium while using it in C#? -


i setup selenium remote driver , run selenium server.the selenium server running correctly , while try run code using :

        var remoteserver = new uri("http://127.0.0.1:4444/wd/hub");         desiredcapabilities desiredcapabilities = desiredcapabilities.firefox();         desiredcapabilities.isjavascriptenabled = true;  mydriver = new remotewebdriver(remoteserver, desiredcapabilities, new timespan(0,1, 30)); 

no error throws in cmd log , elements can find properly, headache comes while try run using below code :

      var remoteserver = new uri("http://127.0.0.1:4444/wd/hub");        desiredcapabilities desiredcapabilities = desiredcapabilities.htmlunit();        desiredcapabilities.isjavascriptenabled = true;        mydriver = new remotewebdriver(remoteserver, desiredcapabilities, new timespan(0, 1, 30)); 

in log throws lots of error , while try find element, timeout exception showing in log. test code in below :

        mydriver.manage().window.maximize();         mydriver.navigate().gotourl(tollfreeurl);         iwebelement planclick = mydriver.findelement(by.classname("trial"));         planclick.click();         iwebelement startplan = mydriver.findelement(by.id("choose2000"));         startplan.click();         iwebelement selectvalue = mydriver.findelement(by.name("areacode"));         var selectelement = new selectelement(selectvalue);         selectelement.selectbyvalue("800");  iwebelement selectnumber = mydriver.findelement(by.xpath("//*[@id='divlist']/div[1]"));         tollfreenumber = selectnumber.text;         tollfreenumber = stringconvert.stringrefiner(tollfreenumber, " ");         tollfreenumber = stringconvert.stringrefiner(tollfreenumber, "(");         tollfreenumber = stringconvert.stringrefiner(tollfreenumber, ")");         tollfreenumber = stringconvert.stringrefiner(tollfreenumber, "-");         console.writeline(tollfreenumber); 

my target run application in background , generate data, not have option run using firefox.htmlunit option me.help needed stuck me last 3-4 days.

i believe machine using proxy servers. try adding proxy configuration while creating driver instance.

string proxy = "xx.xx.xx.xx:8080";  openqa.selenium.proxy proxy = new openqa.selenium.proxy(); proxy.httpproxy=proxy; proxy.ftpproxy=proxy; proxy.sslproxy=proxy; 

add proxy setting desired capabilities:

desiredcapabilities.setcapability(capabilitytype.proxy, proxy); 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -