selenium.common.exceptions.WebDriverException: Message: File not found: /path/to/file - python-3.x

the html part looks like this:
...
<form action="/upload/select-single/" method="post" enctype="multipart/form-data">
<input type="hidden" name="csrfmiddlewaretoken" value="U3Uh3EAYWXaWEiNaWC3zcCQutQe8hGM53u4BTx810o08t1GwOfIJI2ayHCFQFySw">
<p>
<label for="id_file_field">File field:</label>
<input id="id_file_field" name="file_field" type="file" multiple="" required="">
</p>
<input id="submit" type="submit" value="submit">
</form>
...
the selenium test like this:
...
btn_choose_file = self.browser.find_element_by_id("id_file_field")
# write file path to field
# to check that I really selected the field, I tried btn_choose_file.click() -> and it works
btn_choose_file.send_keys('/path/to/file') # -> THIS is the line which seems to cause the problem
# click submit
self.browser.find_element_by_id("submit").click()
...
unfortunately when the test is executed this error is raised
selenium.common.exceptions.WebDriverException: Message: File not found: /path/to/file
this due to the part where the file path is send to the input element with btn_choose_file.send_keys('/path/to/file')
note: the real '/path/to/file' is the following
/Users/udos/development/trails/processfile/gpx_data/test_data/suite 001 - val poschiavo/Bernina - Le Prese.gpx (the file exists and I copied the path from the IDE)
very odd behaviour. this test was running before, somehow I managed to break it...
any suggestions what the cause could be?
UPDATE downgrading Firefox from version 55.0.2 to 54.0.1 "fixed" the issue.see -> https://stackoverflow.com/a/45753912/420953

One way to work around the issue is to replace all "/" occurances in the filename with "\" ("\\" in python).
This work at least on Windows.

After this bug i installed and used chromewebdriver. Worked like firefox driver and all my tests run smoothly. I suggest you try it at least it worked like a charm for me

this error was due to an update of Firefox to version 55.0.2 (which automatically happened 2 days ago because I have automatic updates configured)
the following geckodriver issue pointed me into this direction
https://github.com/mozilla/geckodriver/issues/659note: probably this issue was reintroduced in 55.0.x...
I then downgraded my Firefox version to 54.0.1 as described in article
https://support.mozilla.org/en-US/kb/install-older-version-of-firefoxnote: make sure to disable automatic updates as described in that article.
with this, the selenium tests are running again.

Related

Image not rendering in md format file in Gitlab

I have a directory called "features" in the root and inside this directory has image "state_transitation.JPG" and document "myMdc_features.md"
I am trying to add an image "state_transitation.JPG" to the md extension document "myMdc_features.md" in my repository by using markdown below:
![alt text](./state_transitation.JPG)
![alt text](/state_transitation.JPG)
![alt text](state_transitation.JPG)
<p>
<img src="state_transitation.JPG" />
</p>
I tried all above options but this is giving page could not be found error. 404
Both myMdc_features.md and image file are in same path/directory.
What is the correct way to display an image in gitlab myMdc_features.md?
I think that the first option should work, assuming they are in the same folder. I made an example repostiory here that works.
Source of the file:
Hello World
![](./i-have-no-idea-what-im-doing.jpg)
Output in GitLab:

ckeditor set custom skinpath

I have a problem with the CKEDITOR. I installed it with bower and changed the basepath. So CKEDITOR works.
My problem now is to laod a custom skin, because i download it also with bower.
This is the code:
<textarea id="editor-<?= $block_count ?>" name="block[<?= $block_count ?>][text][]" rows="10" cols="80" class="form-control"></textarea>
<script>
CKEDITOR.replace('editor-<?= $block_count ?>',{
customConfig: '../../dist/scripts/ckeditor.js',
skin: 'office2013'
});
</script>
But if it want to laod the skin i get this error message:
ckeditor.js:76 GET
htttp://myurl.com/src/bower_components/ckeditor/skins/office2013/editor.css?t=G87D
Can i define a skinpath to load it from teh bower path like:
CKEDITOR.replace('editor-<?= $block_count ?>',{
customConfig: '../../dist/scripts/ckeditor.js',
skinpath: 'src/bower_componnts/ckeditor-office2013-skin/office2013/',
skin: 'office2013'
});
Yes you can. Check the documentation. Quoting docs:
It is possible to install skins outside the default skin folder in the editor installation. In that case, the absolute URL path to that folder should be provided, separated by a comma ('skin_name,skin_path').
config.skin = 'moono';
config.skin = 'myskin,/customstuff/myskin/';
So, something similar should do the trick:
skin: 'office2013,/src/bower_components/ckeditor-office2013-skin/office2013/'

simple loadtesting my nodejs app using loadtest module

I am trying to load test my nodejs app using loadtest module.My app accepts a json from a form and parse it.The form looks like
<form action="http://localhost:8081/json"
method="post" >
<label>
Copy paste json
</label>
<textarea name="json" required cols="30" rows="5"></textarea>
<input type="submit" name="submit" ,id="submit">
Problem: When i try to loadtest this using the argument as below
loadtest.js -c 10 --rps 200 -P '{"json":"{"employees":[{"firstName":"John", "lastName":"Doe"},{"firstName":"Anna", "lastName":"Smith"},{"firstName":"Peter", "lastName":"Jones"}]}"}' -T 'application/x-www-form-urlencoded' -m POST http://localhost:8081/json
i am getting
req.body.json
as
undefined
A sample json that i expect is
{"employees":[
{"firstName":"John", "lastName":"Doe"},
{"firstName":"Anna", "lastName":"Smith"},
{"firstName":"Peter", "lastName":"Jones"}]}
I have googled and tried the documentations but i just cant get it fixed.
Please help and thanks in advance

Empty TCL string resulting in non-printable character causing Project-Open to crash

I installed Project Open on ubuntu.
Whenever there is an empty string in tcl then the HTML forms contain a non-printable character instead.
What could cause the issue? Webserver is openACS / AOLServer
TCL Code: set email "" (index.tcl)
ADP Code: email="#email#" (index.adp)
HTML output: <input type="text" name="email" value="?"
(when I save the web-page as htm file then the ? shows hex code 00 in a hex editor - not sure if this is correct.
Anyway there should be no character between the "" for value)
UPDATE 1:
ADP Code: email="t#email#t" (index.adp)
HTML output: <input type="text" name="email" value="tt"
So it really seems to be an empty string. which gets messed up in the ADP file.
UPDATE 2:
according to evil otto's answer it seems to be a AOL Server bug
how to fix it?
nsd -V
AOLserver/4.5.1 (aolserver4_5)
CVS Tag: $Name: aolserver_v45_r1 $
Built: Apr 2 2014 at 08:27:37
Tcl version: 8.6
Platform: linux
there is a known bug in some versions of AOLserver (4.5.0 through last released, but fixed in cvs HEAD) that causes ns_quotehtml to return invalid data when handed an empty string. OpenACS detects and works around this bug but there was a version which did not.
The workaround for an affected version would be to change ns_quotehtml to ad_quotehtml in template::adp_compile, defined in packages/acs-templating/tcl/parse-procs.tcl
See http://openacs.org/forums/message-view?message_id=4078333

Does Firefox disable plugins that failed to initialize?

I am trying to test a Mozilla plugin (developed using FireBreath) in the form of an .so shared object file. The plugin was developed on Ubuntu, where it works fine.
I am now trying it under OpenSUSE - so I first symlinked the .so file in ~/.mozilla/plugins:
> ln -s /path/to/npXXX.so ~/.mozilla/plugins/
... and then ran Firefox (7) from command line:
> /path/to/firefox -P myprofile
...
LoadPlugin: failed to initialize shared library libXext.so [libXext.so: cannot open shared object file: No such file or directory]
LoadPlugin: failed to initialize shared library /path/to/npXXX.so [/path/to/npXXX.so: undefined symbol: gtk_widget_get_mapped]
# and the LoadPlugin messages do NOT show a second time - probably because plugin is disabled (via about:addons).
And so I thought to try different stuff to look into this - but first, I restarted Firefox, and realized that on the second run I do not get the "LoadPlugin: failed to initialize" messages anymore! Then I tried removing the plugins symlink, and restarting FF; and adding it again, and restarting FF - still no error messages!
So, this tells me that probably Firefox somehow disabled/blacklisted the plugin (but which one: libXext, npXXX or both?) , but searching (grepping) for (np)XXX in '/path/to/myprofile/blocklist.xml' returns nothing (the plugin should use a email-like id, not those number GUIDs, so I'd expect that string to show in blocklist.xml if it's there).
Does anyone know: is the default behavior of Firefox to disable/blocklist plugins, that fail to load at first? If so, is there a way to force Firefox to load them again (and spit out error messages)? If you'd also have links to where this behavior is documented, it will be much appreciated :)
Many thanks in advance for any answers,
Cheers!
Note: after I stopped seeing the error messages, I did the following:
I am trying "about:plugins": "No enabled plugins found";
then trying "about:addons", and clicking under Plugins: "You don't have any add-ons of this type installed";
This plugin is not embedded in an extension, so nothing new should be added in "about:addons" under "Extensions" - and as expected, nothing new shows there. Under Ubuntu (where all works), just by symlinking the plugin to ~/.mozilla/plugins, the above two locations/screens start showing the plugin info.
This one of the things that puzzle me - if it just showed the plugin as "disabled", maybe I would have had a chance to re-enable it again (to get a new batch of error messages) - however, "about:plugins" and "about:addons" simply show nothing - so there's nothing I can use to enable from there. Which tells me Firefox has used a different method to disable the plugin(s) - but I cannot tell what it is...
Firefox has a cache for XPCOM modules ("fastload cache"), if a module fails to load Firefox won't try again. The cache is reset automatically if an extension is installed or if the application is updated. Starting with Firefox 4 you can also use -purgecaches command line flag to discard the cache.

Resources