Home > Net >  C # call a small problem, the Selenium also master just a little, please
C # call a small problem, the Selenium also master just a little, please

Time:09-18

Need to operate like Internet explorer, firefox form check some information I chose more convenient Selenium3.3,,,, but need to use foreign agents in the debugging environment,,, but here is a small problem, forwarding speed cannot control has good and bad,,,
 
String ua=Static. GetRandomUA ();
IWebDriver Driver=FirefoxHelper. GetFirefoxDriver (ua);
If (Driver==null)
{
return ;
}
The string url=Static. GetRandomUrl ();
Driver. Navigate (). GoToUrl (url);
Driver. The Manage (). Windows. Maximize ();


It has a blocking, using Selenium loading url to firefox fully open, because the agent, and firefox connection takes a long time, some resources elements on the page has finished loading can be manipulated, actually, but have to wait for loading is completed, and then I set up a global timeout finally cast timeout exception, and unilaterally set larger timeout is also unreliable, because I have found several times the status of timeout exception to see page corner has loaded,
, don't know whether have relations
I want to ask is can let the Selenium don't block the load, I directly to determine whether a state of elements can operate, such silly not to, if firefox can configure load some resources spent much time to get less than give up directly over can also,,, finally whether to have better operating according to my condition the choice of firefox library

CodePudding user response:

Baidu ~ asynchronous programming c #?

CodePudding user response:

I don't know the asynchronous, big brother,, don't know what I say is not clear, or you understand is wrong, because the agent will slow problem loading the page for a long time, and if you don't finish loading the selenium is unable to locate elements,,, even if you take the asynchronous also have to wait so long,,, but I don't mean may selenium to regulate page loading situation, analytic element object, directly, by my own writing code to determine whether to continue operating,, or what makes firefox skip loading for a long time,,,, but still thank you for your answer

CodePudding user response:

Should look at this I just didn't understand for you mean you want to ask the program but should be hung in a certain way, until the remote server timeout exception thrown link?

CodePudding user response:

No master knows

CodePudding user response:

WebDriver IJavaScriptExecutor js=(IJavaScriptExecutor);
Js. ExecuteScript (" window. Stop ();" );
This can stop the loading page and not an error
  •  Tags:  
  • C#
  • Related