Selenium InvalidArgumentException on opening webpage without protocol specified (http/https) - python-3.x

On Windows 10 (64bit, python3.6.8), I'm unable to open link via driver's get method in case link was filled without http:// or https:// protocol specified.
I use selenium==3.141 and msedge-selenium-tools-3.141.2 with python.
Microsoft Edge version 85.0.564.51 (same as driver version).
The following code raises error:
from msedge.selenium_tools import Edge, EdgeOptions
options = EdgeOptions()
options.set_capability('platform', 'Windows')
options.use_chromium = True
path = r'<correct path to driver>'
driver = Edge(executable_path=path,
service_args=None,
options=options,
desired_capabilities={})
driver.get('google.com')
Error: selenium.common.exceptions.InvalidArgumentException: Message: invalid argument (Session info: MicrosoftEdge=85.0.564.51)
Browser state on error - browser is launched and points to data:, url.
After some investigation, I found that in case I change driver.get('google.com') to driver.get('http://google.com'), issue is not reproducible.

The main concern is, your program shouldn't be stuck with data:, in the url bar. Incase this situation happens the simplest solution would be to crosscheck the following points:
When invoking get() method passing an URL you need to pass the Fully Qualified Domain Name (FQDN). You need to ensure the url is properly formatted. As an example, the protocol i.e. http is appended along with the actual url as follows:
https://www.google.com/
Additionally, you also need to ensure that you are using compatibile version of binaries in terms of Google Chrome Browser and ChromeDriver

I agree with the suggestion given by the #DebanjanB.
When using driver.get("URL") method you need to compulsory pass the protocol with the URL.
If you do not pass the protocol then you will get an error.
The error might be a little bit different based on the programming language you are using.
I suggest you refer to this document and try to fully read it. It is for Firefox and using the JAVA language but the logic remains the same for all the browsers and all the programming languages. I hope it will help you to clear your confusion.

After I tried to run the same code on another machine, it worked pretty well without any errors. For me it looks like some issues with setup or Parallels VM I used on first machine

Related

source URI is not allowed in this document

I am working on a website on my localhost and suddenly I'm now getting this errors.
I get this error on Firefox
<script> source URI is not allowed in this document
And nothing on chrome,` but if I try using the files code, I get:
Application Error: There was a problem getting data for the application you requested. The application may not be valid, or there may be a temporary glitch. Please try again later.
It is basically for: https://connect.facebook.net/en_US/sdk.js.
The browser doesn't even send a GET request for the file.
Everything used to work perfect before. Not sure why I'm getting this.
I had an extension installed on both of my browsers. It was preventing it from loading.
If you have any VPNs, hide-tracking extensions, then it needs to be disabled.
In my case it was Disconnect firefox/chrome extension.

Getting the current page in TestComplete

I am writing a Script for TestComplete using JScript.
According to the documentation I can get the current page using the line:
page = browser.Page("*");
But instead I get a message: waiting for "*" and after that an error that the page "*" was not found.
Maybe I got something wrong there. What I am looking for is a method that gives me the Page Object for the current page I am on. Can anyone help me and tell me if such a method exists.
I want to avoid using NameMapping because in there the objects are fixed in their containers. In the project I test these containers may change so I use xpath recognition all the way through.
The code you specified should work if:
The browser variable contains a reference to a specific browser (e.g. Sys.Browser("firefox")).
The browser variable is the current browser (Sys.Browser()) and the current browser is set. The current browser is set when you call the Run or Navigate method of a browser object (e.g. Browsers.Item("firefox").Run();).
You have a page opened in the current browser.
The browser version is supported. Make sure that you have the latest version of TestComplete (11.11 by the moment) to be sure that your browser is supported.

Can I change the logo of an IBM community through the REST API

I found this piece of documentation that suggests that we should be able to PUT a new logo in a community.
But the documentation also states that it is ignored on input.
Before we start intensive troubleshooting, it would help if someone could confirm that we can indeed change the logo programmatically.
Use the web address in the href attribute to obtain an image that represents the community's logo. The following operations are supported:
GET
Use the web address in the href attribute to obtain the community logo image file. If a logo has not been set, a default image is returned.
PUT
Use the web address in the href attribute to upload a new community logo image and replace the current one.
Attention: Specify the content type of the image file being sent with the request. For example: "Content-Type: image/jpeg"
This is the source:
http://www-10.lotus.com/ldd/appdevwiki.nsf/xpDocViewer.xsp?lookupName=IBM+Connections+4.5+API+Documentation#action=openDocument&res_title=Community_entry_content_ic45&content=pdcontent
Using the IBM SBT SDK 1.0.1 I was able to call CommunityService.updateCommunityLogo(new File("/path/to/my.jpeg"), communityUuid) without any error, but the JPEG I referred to was not set as the community logo however.
Maybe the size was not correct?
Sorry for this "non-answer", but it may help other people anyway: To fix the SBT SDK code at least :-/
UPDATE 2014-JUN-25:
I took a deeper dive into the http.wire logs, and surprisingly the call seems to trigger a logout (or session invalidation) without further notice. The REST request receives 200 OK but also some JavaScript looking like "hey guy, confirm who you are", and the browser prompts with a full-window Connections login prompt, although the LTPA token should not have timed out yet.
This is annoying, too, for another reason: If Connections is used inside a framed UI, the "main" application is wiped away after that, forcing Connections to full-window mode.
With IBM SBT SDK 1.0.3 (as of July 17, 2014) and IC5 it is working now. I had no opportunity to test this feature with 1.0.3 and IC45 however, but with 1.0.2 and IC5 it did NOT work; so it seems that something in 1.0.3 has been fixed here.
#mpjjonker you can look at CommunityService.java
the method updateCommunityLogo talks about using /communities/service/html/image URL to put the image.
String url = "/communities/service/html/image";
getClientService().put(url, parameters, headers, file, ClientService.FORMAT_NULL);

NaCl is supposed to be enabled by default in unpacked extensions, yet I can't use it from one

"NaCl is currently only turned on by default for applications/extensions from the Chrome Webstore, or unpacked extensions for development purposes." - the Internet
Yet I can't seem to be able to use NaCl from an unpacked extension. (I did not try the Web Store.)
I have a really simple test extension which has the following in its background.js:
function clicked() {
var testNaclElement = document.createElement("embed");
testNaclElement.setAttribute("type","application/x-nacl");
testNaclElement.setAttribute("width",0);
testNaclElement.setAttribute("height",0);
document.body.appendChild(testNaclElement);
alert(testNaclElement.postMessage?true:false);
document.body.removeChild(testNaclElement);
}
chrome.browserAction.onClicked.addListener(updateIcon);
updateIcon();
This extension reports true when the NaCl is enabled in chrome://flags, but when NaCl is disabled in chrome://flags (which is the default) it reports false.
I expected it to report true.
What am I missing?
Update:
It seems that inventing my own detection code not such a good idea after all.
If I create and install an unpacked chrome webapp that points to url X, then NaCl will work on that page, but this detection code will still report false, while the very same code reports true when on a normal webpage with NaCl enabled in chrome://flags.
BUT if create an extension (not a chrome webapp) that uses NaCl in an iFrame which points to url X, then NaCl will not work in it.
BUT if I create a webapp that points to url X and an extension that uses url X in an iFrame, then both will work if installed at the same time.
Update2:
If I actually include the nmf and nexe in the extension, then it works.
Update3:
nexe needn't be included in the extension.
Chrome requires nmf location to belong to extension. Empty nmf attribute doesn't have this property.
a better way to detect if a NaCl module is loaded is to use progress events. see https://developers.google.com/native-client/pepper16/devguide/coding/progress-events for the enumeration of events and an example.
about the url X -- i don't think events propagate pass iframes if the iframe's URL and the container's URL domains differ -- and any enabling of NaCl in the web store or unpacked extensions corresponds to an URL (possibly with a special proto-spec; i don't know the details), so that might explain the various combinations that you're seeing. it probably also depend on how you specified the URL set in the webapp manifest.
the code's testNaclElement lack a src= attribute/value pair. it's been a while since i looked at the NaCl plugin's code, but that might also cause problems.

why i can't pass parameters to flash using 'file://' protocol?

system info
flash player version: 10_1_102_65
OS: linux debian, 6.0.2
web browser: Mozilla Iceweasel 3.5.16
problem description
I have a flash file that uses parameters to show output on the screen. unfortunately i don't have sources and can't modify/review it.
i can successfully run flash and pass parameters to it using http:// protocol. for example,
#> iceweasel http:///localhost/40.swf?channel_id=1
shows correct flash in the browser.
but when i try to load flash from file
#> iceweasel file:///home/user/40.swf?channel_id=1
flash can't read passed parameter and shows invalid output
it's really strange. because when i downgraded flash plugin (from 10_1_102_65 to 9) both protocols works! That is something occurred in the flash player above 9.
unfortunately i can't use Flash Player 9 in my production environment so i should resolve the issue with Flash Player 10.
question
how can i pass parameters to flash using 'file://' protocol?
any help is appreciated.
thanks.
As Ignacio says, GET parameters are part of HTTP and won't work with the file:// protocol, but one thing you could try is to supply the channel_id is a a FlashVar. Internally in the swf, the ActionScript code normally access GET parameters and FlashVars the same way (using loaderInfo.parameters).
GET only exists in HTTP. You cannot use a query string when accessing a local file. And since you don't have the source, it's near impossible to provide an alternative.

Resources