Selenium WebDriverException: Reached error page - firefox

I am following a Django TDD tutorial at:
http://www.marinamele.com/taskbuster-django-tutorial/taskbuster-working-environment-and-start-django-project
I get the following error when running 'all_users.py' before and after I start the development server 'python manage.py runserver':
Traceback (most recent call last):
File "functional_tests/all_users.py", line 15, in test_it_worked
self.browser.get('http://localhost:8000')
File "/Users/samgao/.virtualenvs/tb_test/lib/python3.6/site->packages/selenium/webdriver/remote/webdriver.py", line 264, in get
self.execute(Command.GET, {'url': url})
File "/Users/samgao/.virtualenvs/tb_test/lib/python3.6/site->packages/selenium/webdriver/remote/webdriver.py", line 252, in execute
self.error_handler.check_response(response)
File "/Users/samgao/.virtualenvs/tb_test/lib/python3.6/site->packages/selenium/webdriver/remote/errorhandler.py", line 194, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Reached error page: >about:neterror?e=connectionFailure&u=http%3A//localhost%3A8000/&c=UTF->8&f=regular&d=Firefox%20can%E2%80%99t%20establish%20a%20connection%20to%20the%20s>erver%20at%20localhost%3A8000.
Basically the connection to localhost cannot be established.
The settings and configurations are identical to the tutorial in the previous link.
I have been struggling with the issue for two days, and would thank you most kindly if you could provide any help.

I got the same error and what solved for me was changing from localhost to 127.0.0.1:
old: self.browser.get('http://localhost:8000')
better: self.browser.get('http://127.0.0.1:8000')

I encountered the same problem, the final solution is: re-install again geckodriver
Unzip the geckodriver.zip
Move the file to /usr/bin directory sudo mv geckodriver /usr/bin
Goto /usr/bin directory cd /usr/bin,then you would need to run something like sudo chmod a+x geckodriver to mark it executable.

this might not be your situation, but I got the same error message when running a test (same book, hehe) without having anything actually listening on the targeted port (8000, in my case). Make sure there's something listening for a request by manually opening your browser and going to localhost:8000. In my case - silly me - I didn't have the server up at all =)

I also followed the same tutorial and came across the same error. I noticed that I am not running the django server. The following is what helped.
python manage.py runserver
python functional_test.py

Being that this is a snapshot (around Django 1.8's time) of "Obey The Testing Goat" - perhaps the instructions there are no longer relevant. I suggest going straight to the goat's mouth and starting over!
The issue could be related to virtualenvwrapper (which is no longer necessary) or it could be related to the port/address that you were trying to access. Depending on your version of Selenium and Firefox there may be issues related to that as well.

It depends on the situation.
Based on mine, after I changed the target URL, I can get the browser to load the URL normally, which means the original URL is not available.
Another way to check:
import requests
html = request.get(url)
Print the HTML, if you get the 503, which means the website is reachable.

Since this is probably a common search result for those working through Obey the Testing Goat, I wanted to share the solution that worked for me. I had written self.browser.get('http://localhost:8000') and needed to use http instead of https to resolve the error.

I got this problem in this situation: the application put the computer name to the proxy host,so the proxy like this:
theComputerName:proxyPort
but the theComputerName:proxyPort can not be visit,so I put this into the host:
127.0.0.1 theComputerName
then restart the application,the problem resolved perfect

I learning TDD tutorial too. My problem was that inputed uncorrect url
http://http://mysite insted of http://mysite

Related

Make dolthub/dolthub-etl-jobs/tree/master/loaders/nvd use newer CVE scheme

I am trying to get some code to run which is here, on GitHub:
https://github.com/dolthub/dolthub-etl-jobs/tree/master/loaders/nvd
Once I've cloned the repo I run the run.sh script and it fails with the below:
./run.sh
1 synchronisation error:
unexpected http response from "https://nvd.nist.gov/feeds/json/cve/1.0/nvdcve-1.0-2002.meta" ("404 Not Found"): ""
cloning https://doltremoteapi.dolthub.com/Liquidata/NVD
For this to have a chance of working I need to change wherever this is referenced:
https://nvd.nist.gov/feeds/json/cve/1.0/nvdcve-1.0-20XX.meta
to:
https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-20XX.meta
The old reference is no longer valid.
However, it's impossible to see where the script is actually calling that URL from. Probably I do not know near enough about how go and GitHub hang together.
If I could figure it out, maybe I could just pull down the code and edit it manually once it was on my host or even create a fork with the new URL in it.
Find where the URL is actually coming from when I call run.sh which errors out almost immediately.
Make a change that reflects the valid one.
TLDR: Replace 4 by 6 in line 44 of main.go.
go.mod from https://github.com/dolthub/dolthub-etl-jobs/tree/master/loaders/nvd
requires github.com/facebookincubator/nvdtools but replaces this by github.com/liquidata-inc/nvdtools which redirects to github.com/dolthub/nvdtools which is an archived repo(!) (cf. https://github.com/dolthub/dolthub-etl-jobs/blob/d858a2433f68d72dc643e26085a5a0c44edbb85c/loaders/nvd/go.mod#L5-L7).
Supported CVE feeds of dolthub/nvdtools are defined here: https://github.com/dolthub/nvdtools/blob/e67111c0fff487cc15cd2ba32668141622cf9c63/providers/nvd/cve.go#L44-L53
cve10jsonGz is 4, cve11jsonGz is 6
main.go sets the CVE feed here: https://github.com/dolthub/dolthub-etl-jobs/blob/d858a2433f68d72dc643e26085a5a0c44edbb85c/loaders/nvd/main.go#L43.
Change it from 4 to 6.
I didn't test the rest of run.sh, but at least the problem you're mentioning in your question should be solved.

Error: No such file (sftp liximomo extension)

I have this problem when I upload a file on the server using the extension liximomo/vscode-sftp for visual studio code.
[error] Error: No such file
at SFTPStream._transform
at SFTPStream.Transform._read
at SFTPStream._read
How I can fix this problem? I tried to upload files to different servers, so I guess it's not a server-related problem but an extension.
There is a better fix on GitHub that works for upload and download via SFTP extension:
Do a search inside ~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js for options.emitClose = false;
Add options.autoDestroy = false; after both instances.
- mrjcgoodwin commented 8 days ago
This is apparently a brand new problem that has been introduced into the newer versions of VS Code. I have FOUND A SOLUTION that seems to work well, by modifying a single line in the extension code. This is only valid for version 1.12.9 of the liximomo.sftp extension.
Here are the steps:
Shutdown / Quit VS Code.
Locate the following file:Mac OS X:
~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.jsWindows:C:\Users\account_name\.vscode\extensions\liximomo.sftp-1.12.9\node_modules\ssh2-streams\lib\sftp.js
Make a backup copy of the file.
Modify line 388, which should be:if ( code === STATUS_CODE . OK ) { changing it to:if (code === STATUS_CODE.OK || code === STATUS_CODE.NO_SUCH_FILE) {
Save the file.
Relaunch VS Code; test by uploading or downloading from your sftp server. The error should not be present.
The alternative solution involves downgrading your version of VS Code. This is not desirable as you are not getting the latest fixes, security patches, etc..
See the following links regarding this issue:
https://github.com/liximomo/vscode-sftp/issues/266
https://github.com/liximomo/vscode-sftp/issues/569 (repeat)
https://gitmemory.com/issue/liximomo/vscode-sftp/915/827578565 (note, this site has a bad SSL certificate).
If you want to downgrade your VS Code; use this link to find the older versions:
https://code.visualstudio.com/updates/v1_55
CREDIT:
Bao from: https://blog.naver.com/PostView.nhn?blogId=pcgun70&logNo=222341271496
From their blog entry (translated by Google to English):
"At first, there was no solution, but Now, 12 hours later, the Holy
One appeared, who told me how to solve it.files that sftp cannot find
in the first place. There is a calling phrase, VScode is upgraded and
an error is called. It came out. Actually, I did not solve the
problem. Even if the file is not found, the same result as the
success process is exported. It is just a modification. It is
expected that a modified version will be released in the future."
Not an answer to the problem, but solution in another (simple) way:
install Run On Save VSCode extension
write a deploy.sh script along the lines
rsync -avz -e 'ssh -i /home/user/.ssh/id_rsa' --exclude '.history' --exclude '.vscode' --exclude '.git' --exclude '.gitignore' --exclude 'deploy.sh' ./ user#domain.net:/home/user/public_html/
add the following configuration to VSCode settings.json to trigger the deploy.sh script on file save:
"emeraldwalk.runonsave": {
"commands": [
{
"match": ".*",
"isAsync": false,
"cmd": "${workspaceFolder}/deploy.sh"
},
]
}
Just switch to the second one:
There is another solution only upgrading the ssh2 package from the extension.
You just need to go to the extension path:
Windows:
C:\Users\your-user\.vscode\extensions\liximomo.sftp-1.12.9
When you are there, change the version of ssh2 package on the package.json file to ^1.1.0. Finally, just run npm install.
You should restart VSCode.
Alternatively, you could use a fork of the repository that is active and fixing these issues: https://github.com/Natizyskunk/vscode-sftp

go-swagger restapi/configure_todo_list.go - api.TodoGetHandler undefined error

I am a newbie in go and go-swagger. I am following steps in Simple Server tutorial in goswagger.io.
I am using Ubuntu 18.04, swagger v0.25.0 and go 1.15.6.
Following the same steps, there are a few differences of the files generated. For instance, goswagger.io's has find_todos_okbody.go and get_okbody.go in models but mine does not. Why is that so?
Link to screenshot of my generated files vs
Link to screenshot of generated files by swagger.io
Starting the server as written in the tutorial go install ./cmd/todo-list-server/ gives me the following error. Can anyone please help with this?
# my_folder/swagger-todo-list/restapi
restapi/configure_todo_list.go:41:8: api.TodosGetHandler undefined (type *operations.TodoListAPI has no field or method TodosGetHandler)
restapi/configure_todo_list.go:42:6: api.TodosGetHandler undefined (type *operations.TodoListAPI has no field or method TodosGetHandler)
The first step in goswagger.io todo-list is swagger init spec .... Which directory should I run this command in? I ran it in a newly created folder in my home directory. However, from the page, it shows the path to be ~/go/src/github.com/go-swagger/go-swagger/examples/tutorials/todo-list. I am not sure whether I should use go get ..., git clone ... or create those folders. Can someone advise me?
Thanks.
This is likely the documentation lagging behind the version of the code that you are running. As long as it compiles, the specific files the tool generates isn't so crucial.
This is a compilation error. When you do go install foo it will try to build the foo package as an executable and then move that to your GOPATH/bin directory. It seems that the generated code in restapi/configure_todo_list.go isn't correct for the operations code generated.
All you need to run this tutorial yourself is an empty directory and the swagger tool (not its source code). You run the commands from the root of this empty project. In order not to run into GOPATH problems I would initialise a module with go mod init todo-list-example before doing anything else.
Note that while the todo-list example code exists inside the go-swagger source, it's there just for documenting example usage and output.
What I would advice for #2 is to make sure you're using a properly released version of go-swagger, rather than installing from the latest commit (which happens when you just do a go get), as I have found that to be occasionally unstable.
Next, re-generate the entire server, but make sure you also regenerate restapi/configure_todo_list.go by passing --regenerate-configureapi to your swagger generate call. This file isn't always refreshed because you're meant to modify it to configure your app, and if you changed versions of the tool it may be different and incompatible.
If after that you still get the compilation error, it may be worth submitting a bug report at https://github.com/go-swagger/go-swagger/issues.
Thanks #EzequielMuns. The errors in #2 went away after I ran go get - u -f ./... as stated in
...
For this generation to compile you need to have some packages in your GOPATH:
* github.com/go-openapi/runtime
* github.com/jessevdk/go-flags
You can get these now with: go get -u -f ./...
I think it's an error of swagger code generation. You can do as folloing to fix this:
delete file configure_todo_list.go;
regenerate code.
# swagger generate server -A todo-list -f ./swagger.yml
Then, you can run command go install ./cmd/todo-list-server/, it will succeed.

D3, loading a csv file, filepath issue ? [duplicate]

I'm just learning d3, and I'm attempting to import data from a CSV file, but I keep getting the error "XMLHttpRequest cannot load file:///Users/Laura/Desktop/SampleECG.csv. Cross origin requests are only supported for HTTP. ". I've searched for how to fix this error and have ran it on a local web server, but I haven't found a solution that works for d3.v2.js. Here's a sample of the code:
var Time = []
ECG1 = []
d3.csv("/Desktop/d3Project/Sample.csv", function(data)
{
Time = data.map(function(d) {return [+d["Time"]];});
ECG1 = data.map(function(d) {return [+d["ECG1"]];});
console.log(Time)
console.log(ECG1)
});
Any help will be much appreciated.
This confused me too (I am also a d3 beginner).
So, for some reason, web browsers are not happy about you loading local data, probably for security reasons or something. Anyways, to get around this, you have to run a local web server. This is easy.
In your terminal, after cd-ing to your website's document root (thanks #daixtr), type:
python -m SimpleHTTPServer 8888 &
Okay, now as long as that terminal window is open and running, your local 8888 web server will be running.
So in my case, originally the web page I was working on was called
file://localhost/Users/hills/Desktop/website/visualizing-us-bls-data-inflation-and-prices.html
When I opened it in chrome. To open up my page on my local web server, I just typed (into the chrome search bar):
http://localhost:8888/Desktop/website/visualizing-us-bls-data-inflation-and-prices.html
Now, reading in CSVs should work. Weird, I know.
To those using built-in python webserver and who are still experiencing issues, do REMEMBER and make sure that you run the "python -m SimpleHTTPServer 8888" invocation at the correct path of which you consider to be your DocumentRoot. That is, you cannot just run 'python -m SimpleHTTPServer 8888' anywhere. You have to actually 'cd /to/correct/path/' containing your index.html or data.tsv and then from there run 'python -m SimpleHTTPServer 8888'.
Also, just learning D3 for school work. I was trying to run this simple D3 example:
https://gist.github.com/d3noob/b3ff6ae1c120eea654b5
I had the same problem as OP re: loading data using Chrome browser. I bet the great solution Hillary Sanders posted above was re: Python 2.X.
My answer is re: Python 3.X [OS: Ubuntu 16x]:
Open a terminal window within the root directory of your project, then run:
python3 -m http.server
It will serve HTTP on port 8000 by default unless it is already taken, in that case to open another port, e.g. 7800, run:
python3 -m http.server 7800
Then, on your Chrome browser address bar type:
localhost:8000
The above worked for me because I only had an index.html page in my root folder. In case, you have a HTML page with a different name, type the whole path to that local HTML page and it should work also. And, you should be able to see the graph created from the data set in my link (that must be in a folder like data/data.csv). I hope this helps. :-)
Use Firefox, idk what Chrome tries to accomplish

Path Error running CakePHP's "cake" console utility in Windows

A while ago when I started with Cake, I managed to get the console running in my Windows environment, and I have no idea how. I'm now having problems to make it work again in another computer.
This is what I've done in the new machine:
Downloaded my Cake code from source control (so all the files are exactly the same as the computer where it worked, including the configuration files)
Added PHP and "c:\my_cake_path\cake\console" to the path
If I run "cake OneOfMyShells", either standing on the /app, or in /cake/console directories, I get the following error:
Warning: get_object_vars() expects parameter 1 to be object, null given in C:\my_cake_path\cake\libs\model\connection_manager.php on line 199
Error: Missing Database Connection. Try 'cake bake'
"cake Bake", if run normally, when I try to get it to do the DB config ends up throwing another error (which is not that relevant to this)
However, if I run: cake bake -app "c:\my_cake_path\app"
Then bake works, I can do the database config, and it writes the DB config file (which is useless at this point, since I already had one)
Then, of course: cake OneOfMyShells -app "c:\my_cake_path\app"
does work perfectly well.
So, everything's working fine, I just need to manually specify the path to "app" every single time, which is very annoying.
How can I get around this? Where is Cake looking for to find the path to app?
Thanks!
Daniel
Not much of a difference in the sense you still need to type but you can run cake from the app dir like this: C:\XXX\project\app> ..\cake\console\cake.bat
To make it smaller you can put that line on a .bat or just add the \cake\console dir the windows path

Resources