"Cannot call the" indexOf "method from undefined" when using Google Chrome (* googlechrome) as the target of Selenium RC

I am trying to run a test in the beta version of Google Chrome 9.0.597.98 using Selenium Grid. I am firing the test with C # using the default * googlechrome target that comes with the Selenium Grid. When I try to open a site, I am greeted "Unable to call the" indexOf "method from undefined" .

I found a message from someone who suggested that the solution is to slightly reduce Chrome's security by passing some parameters. This post suggests using something like this:

DefaultSelenium selenium = new DefaultSelenium(location, port, browser, targetPath);

BrowserConfigurationOptions bco = new BrowserConfigurationOptions();

selenium.start(bco.setCommandLineFlags("--disable-web-security"));

For some reason, I do not see BrowserConfigurationOptionsanywhere. Is this something that comes with the Selenium dll? Is this something that is not available in the .NET version, but is in others? What options should I set for this option --disable-web-security and is there a better way to do this?

enter image description here

+3
source share
3 answers

try it

[TestInitialize]

public void PreTest()
{
 selenium = new    DefaultSelenium("localhost",4444,"googlechrome","http://www.ryanhayes.net")
}


[TestMethod]

public void TestRyanHayesDotNet()
{
selenium.Open("/")

}

removal / after ryanhayes.net fixes the problem

+1
source

Thank you very much for this, I was looking for this information, and I got it here! Now I can run my test in googlechrome, I used to get the same problem.

The following code works for me:

BrowserConfigurationOptions webSec = new BrowserConfigurationOptions();
selenium.start(webSec.setCommandLineFlags("--disable-web-security"));
+1
source

You are right in assuming that .Net does not have an object BrowserConfigurationOptions, but, fortunately, you do not need it (this is just a thin shell). DefaultSelenium has two overrides for the method Start(). One of them does not accept any parameters and usually launches a browser, and the other accepts a string defining the parameters of the browser. tryselenium.Start("--disable-web-security")

0
source

Source: https://habr.com/ru/post/1791886/


All Articles