1

PROBLEM: FF Browser is showing this error on running following program : The address wasn’t understood.Firefox doesn’t know how to open this address because one of the following protocols (c) isn’t associated with any program or is not allowed in this context.You might need to install other software to open this address.How to resolve this error?

PROGRAM:

package com.packt.webdriver.chapter3;

import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.*;

public class ActionBuildPerform
{
   public static void main(String[] args)
    {
    System.setProperty("webdriver.gecko.driver","C:\\Users\\Pragati    Chaturvedi\\Desktop\\Selenium Web Driver\\geckodriver.exe");
    WebDriver driver = new FirefoxDriver();
    driver.get("C:\\Users\\Pragati Chaturvedi\\Desktop\\Selenium Web Driver\\8850OS_Code\\Chapter 2\\HTML\\Selectable.html");
    WebElement one = driver.findElement(By.name("one"));
    WebElement three = driver.findElement(By.name("three"));
    WebElement five = driver.findElement(By.name("five")); // Add all the actions into the Actions builder.
    Actions builder = new Actions(driver);
    builder.keyDown(Keys.CONTROL).click(one).click(three).click(five).keyUp(Keys.CONTROL); // Generate the composite action.
    Action compositeAction = builder.build(); //Perform the composite action.
    compositeAction.perform();
}

}

Console Output:-

1490634882750   geckodriver INFO    Listening on 127.0.0.1:19171
1490634883544   mozprofile::profile INFO    Using profile path       
C:\Users\PRAGAT~1\AppData\Local\Temp\rust_mozprofile.dcx9kJg3PT9r
1490634883559   geckodriver::marionette INFO    Starting browser C:\Program    
Files\Mozilla Firefox\firefox.exe with args []
1490634883575   geckodriver::marionette INFO    Connecting to Marionette on   
localhost:59372
[GFX1]: Potential driver version mismatch ignored due to missing DLLs   
0.0.0.0 and 0.0.0.0
1490634885334   Marionette  INFO    Listening on port 59372
[GFX1]: Potential driver version mismatch ignored due to missing DLLs    
0.0.0.0 and 0.0.0.0
Mar 27, 2017 1:14:49 PM org.openqa.selenium.remote.ProtocolHandshake    
createSession
INFO: Detected dialect: W3C
JavaScript error: chrome://marionette/content/listener.js, line 1081:     
NS_ERROR_UNKNOWN_PROTOCOL: 
Exception in thread "main" org.openqa.selenium.WebDriverException: Reached     
error page: about:neterror?                                     









 e=unknownProtocolFound&u=c%3A%5CUsers%5CPragati%2520Chaturvedi%5CDesktop%5CSelenium%2520Web%2520Driver%5C8850OS_Code%5CChapter%25202%5CHTML%5CSelectable.html&c=&f=regular&d=Firefox%20doesn%E2%80%99t%20know%20how%20to%20open%20this%20address%2C%20because%20one%20of%20the%20following%20protocols%20%28c%29%20isn%E2%80%99t%20associated%20with%20any%20program%20or%20is%20not%20allowed%20in%20this%20context.
Build info: version: '3.3.1', revision: '5234b32', time: '2017-03-10    
09:04:52 -0800'
System info: host: 'PRAGZ-LAPPY', ip: '10.0.0.110', os.name: 'Windows 10',    
os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities     
  [{moz:profile=C:\Users\PRAGAT~1\AppData\Local\Temp\rust_mozprofile.dcx9kJg3PT9r, 
rotatable=false, timeouts={implicit=0, page load=300000, script=30000},   
pageLoadStrategy=normal, platform=ANY, specificationLevel=0,   
moz:accessibilityChecks=false, acceptInsecureCerts=false,   
browserVersion=52.0.1, platformVersion=10.0, moz:processID=19664,   
browserName=firefox, platformName=windows_nt}]
Session ID: 430d1b8b-4d2c-4cdc-939e-ccfa8fb543f4
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at   

sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorI    mpl.java:62)
at    
    sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorA    ccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at    
org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:133)
at   org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:99)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:43)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:163)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:604)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:325)
at     com.packt.webdriver.chapter3.ActionBuildPerform.main(ActionBuildPerform.java:13)

HTML FILE ASSOCIATED (Selectable.html):-

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery UI Selectable - Display as grid</title>
<link rel="stylesheet"    
href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<style>
#feedback { font-size: 1.4em; }
#selectable .ui-selecting { background: #FECA40; }
#selectable .ui-selected { background: #F39814; color: white; }
#selectable { list-style-type: none; margin: 0; padding: 0; width: 450px; }
#selectable li { float: left; width: 100px; height: 80px; font-size: 4em;     
text-align: center; }
</style>
<script>
$(function() {
$( "#selectable" ).selectable();
});
</script>
</head>
<body>
<ol id="selectable">
<li class="ui-state-default" name="one">1</li>
<li class="ui-state-default" name="two">2</li>
<li class="ui-state-default" name="three">3</li>
<li class="ui-state-default" name="four">4</li>
<li class="ui-state-default" name="five">5</li>
<li class="ui-state-default" name="six">6</li>
<li class="ui-state-default" name="seven">7</li>
<li class="ui-state-default" name="eight">8</li>
<li class="ui-state-default" name="nine">9</li>
<li class="ui-state-default" name="ten">10</li>
<li class="ui-state-default" name="eleven">11</li>
<li class="ui-state-default" name="twelve">12</li>
</ol>
</body>
</html>

TEST DATA 1. Java :- java version "1.8.0_121" Java(TM) SE Run-time Environment (build
1.8.0_121-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed
mode)
2. Selenium Excutable JAR files:- selenium-server-standalone-3.3.1
3. FF Browser:- 52.0.1 (64-bit)
4 Eclipse:- Eclipse IDE for Java Developers Version: Neon.2 Release (4.6.2)
Build id: 20161208-0600
5. Geckon Driver:- geckodriver-v0.15.0-win64
6. OS:- Microsoft WIndows 10 Home - 64-Bit

2
  • If you open this manually is that the same url you get from the browser rendering?
    – mutt
    Commented Mar 27, 2017 at 21:16
  • 1
    I don't have access to a Windows machine right now, but I'm pretty sure you'd see the exact same error if you put a file path in the address bar (which is pretty much what driver.get("C:\\some\\path\\file.html") is doing). Trying adding a file:// to the start to specify the file protocol instead of the C protocol . . .
    – ernie
    Commented Mar 28, 2017 at 18:27

2 Answers 2

1

Browsers cannot open files directly, you always need to specify a protocol, eg http:// or file://.

driver.get("C:\\Users\\Pragati Chaturvedi\\Desktop\\Selenium Web Driver\\8850OS_Code\\Chapter 2\\HTML\\Selectable.html");

This should be replaced by something like:

driver.get("file:///C:\\Users\\Pragati Chaturvedi\\Desktop\\Selenium Web Driver\\8850OS_Code\\Chapter 2\\HTML\\Selectable.html");

Read more about the file URI scheme here: https://en.wikipedia.org/wiki/File_URI_scheme

Examples:

file://localhost/c:/WINDOWS/clock.avi

file:///c:/WINDOWS/clock.avi

Make sure you try to open the file manually first in Firefox to see it works. You can also open the file with Firefox and then copy the URI.

0

Are you missing a } here:

  compositeAction.perform();
  } <-------
}

?

It is missing in your code but maybe it is partial code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.