403 : Access forbidden selenium - selenium

I want to run my testcases with the help of parameters mentioned in the testSuite.xml file and use them in my test cases by mentioning
#Parameters({ "selenium.host", "selenium.port", "selenium.browser", "selenium.url" }) in my code.
Though, I started a standalone server with -trustAllSSLcertificates, the system is giving "403 access forbidden error". However, if I run the test cases individually, by hardcoding the port, URL, Host & browsername, it works fine.
Where am i going wrong?.....
BTW, I run my test cases using build.xml file. Here also i added the -trustAllSSLcertificates when starting the server. But still it does not work.
Please help.

When running Selenium WebDriver using selenium-server-standalone I kept getting this error.
HTTP ERROR: 403
Forbidden for Proxy
RequestURI=/session
Turns out that it was because I needed to use the url http://localhost:4444/wd/hub as the url for the RemoteWebDriver client to connect to.
I'm sure there are a number of things that could cause the HTTP ERROR: 403, but you may want to double-check that it's resolving to the correct base url.

Related

Spartacus - Error occurred while trying to proxy request

when doing yarn start in spartacus application at localhost , I am getting following error:
[HPM] Error occurred while trying to proxy request /rest/v2/electronics-spa/cms/pages?fields=DEFAULT&pageType=ContentPage&pageLabelOrId=homepage&lang=en&curr=USD from localhost:4200 to https://localhost:
9002 (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors)
I have pretty standard proxy.bankend.js file. Any suggestions what i can investigate ?
I already tested backend is reachable via url directly.
Regards,
Archit
I am familiar with this situation. Usualy this error happens when the endpoint I an trying to proxy to is not reachable.
Looking at the error I can see your request is still going to https://localhost:9002 so I believe it's possible your proxy might not be picked up.
You should make sure that you specified the proxy config correctly. It can be done in your package.json by modifying the start script: "start": " ng serve --proxy-config proxy/proxy.backend.js", (in this case my proxy is in a proxy folder).
Hope this helps!

How can i change the contextpath of jenkins?

We have a situation trying to run jenkins behind apache,
we need to specify a new context path because we already have an instance of jenkins in ./Jenkins, so we try to use the parameter --prefix=/jenkins2/ in order to have the 2 instances separated.
The problem is that with that parameter, when i hit the url http://myserver.com/jenkins2 i have this:
HTTP ERROR 404
Problem accessing /. Reason:
    Not Found
Powered by Jetty:// 9.4.z-SNAPSHOT
any help?
In /etc/sysconfig/jenkins or /etc/default/jenkins change the follow line
JENKINS_ARGS=""
to
JENKINS_ARGS="--prefix=/jenkins2"
you can also run in a different por changing JENKINS_PORT in the same file.
Probably yours is not working because the "/" in the end "/jenkins2/"
If you can't find these files, you can check where is viewing the content of /etc/init.d/jenkins, in the line starting with "JENKINS_CONFIG="
If you are not running jenkins as service you can run:
java -jar jenkins.war --prefix=/jenkins2

Selenium ChromeDriver Failed to load resource: net::ERR_CONNECTION_CLOSED

I'm using Codeception to run some acceptance tests using WebDriver and a Docker Selenium standalone server. I noticed that after one of my tests threw an error I get this logged:
[Selenium browser Logs]
13:59:52.345 SEVERE - https://ssl.google-analytics.com/ga.js - Failed to load resource: net::ERR_CONNECTION_CLOSED
Funny thing is that there isn't any google analytics on the page at all (or the app for that matter). I'm guessing that there is some anonymous usage analytics but can't tell whose it is, whether it's Selenium, Codeception or it's included libs, or even the ChromeDriver for Selenium. I run the Selenium server with --net=host and maybe that has something to do with it.
Anyone know how to turn these analytics off or let Codeception ignore failed external resources?
add the following entry to your local hosts file,
127.0.0.1 www.google-analytics.com
127.0.0.1 google-analytics.com
127.0.0.1 ssl.google-analytics.com
This works for all browsers, regardless of whether they support plugins. As long as you don't run a web server on your local machine, these connections are instantly rejected and so don't take very long to fail.
You could also try 0.0.0.0 (never personally tested by me though).
0.0.0.0 www.google-analytics.com
0.0.0.0 google-analytics.com
0.0.0.0 ssl.google-analytics.com
PS: 0.0.0.0, a null route, is better. If you're running your own web server you'll start to get 404s if your route to localhost.

Getting error "org.openqa.selenium.WebDriverException: java.net.ConnectException: Connection refused:"

I am using selenium webdriver for the testing application. i am using using Marionettedriver for the browser. however when I run the code it gives the error "org.openqa.selenium.WebDriverException: java.net.ConnectException: Connection refused:" I have check the system path also no issue in the same.
so please suggest how to solve the error.
Also getting error " error: Found argument '--webdriver-port' which wasn't expected, or isn't valid in this context
USAGE:
geckodriver.exe [FLAGS] [OPTIONS]".
I am not able to understand for what issue this error is appears. So please let me know how to solve this
I have used the jar file for selenium server and selenium standalone server in the project. still same error shows. Also as mentioned above it shows the error of " error: Found argument '--webdriver-port' which wasn't expected, or isn't valid in this context
USAGE:
geckodriver.exe [FLAGS] [OPTIONS]".
When you run your webdriver tests, you need to "obtain" browser from selenium server/grid. Connection refused message means there is no listening server on a host/port you provided.

Unable to set proxy :selenium.common.exceptions.WebDriverException:Access Denied

I want to use Selenium Webdriver and I am unable to do so because when I run my code, I get the following exception.
My code is very basic and as follows.
from selenium import webdriver
driver = webdriver.Firefox()
driver.get("http://www.google.com.bh")
assert "Google" in driver.title
driver.close()
Exception Message
selenium.common.exceptions.WebDriverException: Message: '<HTML><HEAD>\n<TITLE>Access Denied</TITLE>\n</HEAD>\n<BODY>\n<FONT face="Helvetica">\n<big><strong></strong></big><BR>\n</FONT>\n<blockquote>\n<TABLE border=0 cellPadding=1 width="80%">\n<TR><TD>\n<FONT face="Helvetica">\n<big>Access Denied (authentication_failed)</big>\n<BR>\n<BR>\n</FONT>\n</TD></TR>\n<TR><TD>\n<FONT face="Helvetica">\nYour credentials could not be authenticated: "Credentials are missing.". You will not be permitted access until your credentials can be verified.\n</FONT>\n</TD></TR>\n<TR><TD>\n<FONT face="Helvetica">\nThis is typically caused by an incorrect username and/or password, but could also be caused by network problems.\n</FONT>\n</TD></TR>\n<TR><TD>\n<FONT face="Helvetica" SIZE=2>\n<BR>\nFor assistance, contact your network support team.\n</FONT>\n</TD></TR>\n</TABLE>\n</blockquote>\n</FONT>\n</BODY></HTML>\n'
It opens firefox but after that it is unable to connect to google or any other local sites.
The exception is at driver = webdriver.Firefox()
I googled around and I followed the link on SO.
But unfortunately I still get the same error.
I cannot run as the root user. I changed my proxy settings and set No Proxy element for localhost as well as mentioned in the link.
I am using Python 2.7 and have installed selenium 2.31 version.
I also tried setting proxy.
myProxy = "*********:8080"
proxy = Proxy({
'proxyType': ProxyType.MANUAL,
'httpProxy': myProxy,
'ftpProxy': myProxy,
'sslProxy': myProxy,
'noProxy': 'localhost,127.0.0.1,*.abc'
})
driver = webdriver.Firefox(proxy=proxy)
I also tried to set the proxy to system's proxy i.e., in the above code, 'proxyType': ProxyType.SYSTEM
But it again gives the above exception message.
is there a place where I have to set my username and password?
Any help would be appreciated!
Remove proxy settings from all the browsers on the system manually. I had IE, Firefox and Google Chrome.
When I removed the proxy settings of all the browsers and enabled the proxy only on Firefox,it worked without giving any errors. I do not know the exact reason why this works like this, may be got to do with the registry settings on windows which I am not sure about.
After doing the above said, I ran the basic code and it worked fine.
from selenium import webdriver
driver = webdriver.Firefox()
driver.get("http://www.google.com.bh")
assert "Google" in driver.title
driver.close()
I didn't set the proxy explicitly also. By default, it had taken the system's proxy settings. Hope this would help others facing similar issue.