Selenuim, WebDriver: SessionNotCreatedException: "errorMessage": "Message: session not created: Missing or invalid capabilities" - selenium-chromedriver

So I am using chrome driver version 103.0.5060.53 and chrome version 103.0.5060.114 running on an ECR image based on public.ecr.aws/lambda/python:3.9-x86_64. The error that I am getting with the first code is "errorMessage": "Message: session not created: Missing or invalid capabilities\n (Driver info: chromedriver=103.0.5060.53 (a1711811edd74ff1cf2150f36ffa3b0dae40b17f-refs/branch-heads/5060#{#853}),platform=Linux 5.10.16.3-microsoft-standard-WSL2 x86_64)\n", "errorType": "SessionNotCreatedException"
chrome_opts = Options()
chrome_opts.add_argument("--allow-running-insecure-content")
if 'DOCKER_AUTH_CONFIG' in os.environ:
chrome_opts.add_argument('--headless')
chrome_opts.add_argument('--no-sandbox')
chrome_opts.add_argument('--disable-dev-shm-usage')
self.headless = True
chrome_opts.add_argument("window-size=1920,1080")
chrome_opts.binary_location = '/usr/bin/google-chrome'
chrome_opts.add_experimental_option('w3c', False)
desired_cap = {}
desired_cap['platform'] = 'ANY'
desired_cap['browserName'] = 'chrome'
desired_cap['loggingPrefs'] = {'performance': 'INFO'}
desired_cap['options'] = chrome_opts.to_capabilities()
self.driver = webdriver.Chrome(service = Service('/usr/local/bin/chromedriver'), options = chrome_opts, desired_capabilities=desired_cap)
And with the second code I am getting: "errorMessage": "Message: unknown error: Chrome failed to start: exited abnormally.\n (unknown error: DevToolsActivePort file doesn't exist)\n (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.
chrome_opts = Options()
chrome_opts.add_argument("--allow-running-insecure-content")
if 'DOCKER_AUTH_CONFIG' in os.environ:
chrome_opts.add_argument('--headless')
chrome_opts.add_argument('--no-sandbox')
chrome_opts.add_argument('--disable-dev-shm-usage')
self.headless = True
chrome_opts.add_argument("window-size=1920,1080")
chrome_opts.binary_location = '/usr/bin/google-chrome'
chrome_opts.add_experimental_option('w3c', False) # Needed for chromedriver 75 (logging doesn't work in w3c mode)
desired_cap = {}
desired_cap['platform'] = 'ANY'
desired_cap['browserName'] = 'chrome'
desired_cap['loggingPrefs'] = {'performance': 'INFO'}
desired_cap['options'] = chrome_opts.to_capabilities()
self.driver = webdriver.Chrome(service = Service('/usr/local/bin/chromedriver'), desired_capabilities=desired_cap)
I don't know honestly what error is better than the other, I tried to play with many options according to what I found in the web.
Can somebody help me solve this issue and understand it please.
---- Update:
Now I am getting this error after using:
WebDriverException: Message: unknown error: unable to discover open window in chrome
(Session info: headless chrome=103.0.5060.114)
chrome_opts = Options()
chrome_opts.add_argument("--allow-running-insecure-content")
chrome_opts.add_argument('--headless')
chrome_opts.add_argument('--no-sandbox')
chrome_opts.add_argument('--disable-dev-shm-usage')
chrome_opts.add_argument('--remote-debugging-port=9222')
self.headless = True
# chrome_opts.add_argument("window-size=1920,1080")
# chrome_opts.add_experimental_option('w3c', False) # Needed for chromedriver 75 (logging doesn't work in w3c mode)
caps = webdriver.DesiredCapabilities.CHROME.copy()
caps['acceptInsecureCerts'] = True
print('caps')
self.driver = webdriver.Chrome(options= chrome_opts, desired_capabilities=caps)

Related

Selenium chromedriver unknown error while running chrome 59 headless with browsermob proxy

I wrote a simple Selenium test (opening a page) of a secured site in a headless mode using Chrome 59 beta version.
I'm getting an the following exception while executing my code. The exception is thrown while initializing the driver
When I rerun my script after commenting the headless option (options.addArguments("headless")) it shows Chrome and running fine but my objective is to run it as headless. Could you please provide your thoughts on resolving my problem?
Exception:
Starting ChromeDriver 2.29.461585 (0be2cd95f834e9ee7c46bcc7cf405b483f5ae83b) on port 4971
Only local connections are allowed.
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.29.461585 (0be2cd95f834e9ee7c46bcc7cf405b483f5ae83b),platform=Mac OS X 10.12.2 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.14 seconds
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
Here are the steps:
I'm using Scala with SBT on Mac.
Chrome 59 beta version
ChromeDrive 2.29 release version.
Added the following dependencies
"org.seleniumhq.selenium" % "selenium-chrome-driver" % "3.4.0"
"org.seleniumhq.selenium" % "selenium-support" % "3.4.0"
"net.lightbody.bmp" % "browsermob-core" % "2.1.4"
Scala Code:
val username = "username"
val password = "password"
val domainname = "yoursecuredomain.com"
val browserMobProxyServer = new BrowserMobProxyServer()
browserMobProxyServer.start(0)
browserMobProxyServer.autoAuthorization(domainname, username, password, AuthType.BASIC)
val seleniumProxy = ClientUtil.createSeleniumProxy(browserMobProxyServer)
val options = new ChromeOptions()
options.addArguments("headless")
options.addArguments("--disable-gpu")
options.setBinary("""/Applications/Google Chrome.app/Contents/MacOS/Google Chrome""")
val desiredCapabilities = new DesiredCapabilities()
desiredCapabilities.setCapability(ChromeOptions.CAPABILITY, options)
desiredCapabilities.setCapability(CapabilityType.PROXY, seleniumProxy)
val driver: WebDriver = new ChromeDriver(desiredCapabilities)
val baseUrlString = s"""https://$domainname"""
driver.navigate().to(baseUrlString)
Thread.sleep(3000)
println("title: " + driver.getTitle)
driver.quit()
browserMobProxyServer.abort()
According to the 2.29 webdriver notes page, It says that
----------ChromeDriver v2.29 (2017-04-04)----------
Supports Chrome v56-58
so u have to downgrade your chrome version to be compatible with the latest chrome webdriver.
source:
https://chromedriver.storage.googleapis.com/2.29/notes.txt

Set TLS Version with Apache Httpclient and WebSphere Liberty Profile

We are accessing an external service from our WebSphere Liberty Profile (8.5.5.6) REST service which uses Apache HTTPClient 4.3.5 to connect to the service.
The service just changed to use TLS v1.2, and now our service is failing with:
[4/21/16 12:23:37:596 EDT] 0000005d bm.myw3.services.awf.sso.ejb.generator.SSOTokenGeneratorImpl I Exception :: javax.net.ssl.SSLException: Received fatal alert: protocol_version
[4/21/16 12:23:37:597 EDT] 0000005d com.ibm.myw3.services.awf.sso.ejb.SSOTokenManagerBean E SSOTokenGeneratorException :: {0}
com.ibm.myw3.services.awf.sso.ejb.config.SSOTokenGeneratorException: Exception while executing http request for retrieving Token
We found the following link, and implemented it in our code:
How to set TLS version on apache HttpClient
SSLContext sslContext = SSLContexts.custom().useTLS().build();
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext, new String[] { "TLSv1.2" }, null, SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
I have also set the 'https.protocols':
wasadmin 28548 1 10 12:28 pts/0 00:00:55 /usr/lib/jvm/jre-1.7.1-ibm.x86_64/bin/java -javaagent:/opt/IBM/WebSphere/Liberty/wlp/bin/tools/ws-javaagent.jar -Djava.awt.headless=true -XX:MaxPermSize=256m -Dcom.ibm.security.jurisdictionPolicyDir=/devops/w3Services/ssoProxy -Dhttps.protocols=TLSv1.2,TLSv1.1,TLSv1 -jar /opt/IBM/WebSphere/Liberty/wlp/bin/tools/ws-server.jar w3svcs-ssoproxy-svr1
But it is making no difference. Is there something else we need to do in order to get this to work with WLP?
We've tried some other things, and here is our latest iteration of the code:
SSLContext sslContext = SSLContexts.custom().useProtocol("TLSv1.2").build();
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext, new String[] { "TLSv1.2" },
new String[] { "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256" },
SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create().setDefaultRequestConfig(requestConfig)
.setConnectionManager(connManager).setSSLSocketFactory(sslsf);
handleAuthentication(uri, httpClientBuilder);
httpClient = httpClientBuilder.build();
I am also setting the following JVM options:
JVM_ARGS=-Dhttps.protocols=TLSv1.2 -Djdk.tls.client.protocols=TLSv1.2 -Djavax.net.debug=all
But we are still getting the error:
[4/21/16 17:27:37:123 EDT] 00000042 id= bm.myw3.services.awf.sso.ejb.generator.SSOTokenGeneratorImpl I Exception :: javax.net.ssl.SSLException: Received fatal alert: protocol_version
[4/21/16 17:27:37:124 EDT] 00000042 id= com.ibm.myw3.services.awf.sso.ejb.SSOTokenManagerBean E SSOTokenGeneratorException :: {0}
com.ibm.myw3.services.awf.sso.ejb.config.SSOTokenGeneratorException: Exception while executing http request for retrieving Token
I have a trace.log from WLP, which I can upload if anyone thinks it would be useful to see. But here aer various entries from the trace:
Default Executor-thread-25, WRITE: TLSv1.2 Handshake, length = 80
Default Executor-thread-25, WRITE: TLSv1.2 Application Data, length = 256
Default Executor-thread-25, READ: TLSv1.2 Application Data, length = 1552
SEND TLSv1.2 ALERT:
Finalizer thread, WRITE: TLSv1.2 Alert, length = 64
And then it goes on to try TLSv1, which the service we're calling doesn't support anymore. I'm not sure what to look for to determine why it's not using TLSv1.2, but nothing is jumping out at me from the trace.
One cannot set a custom socket factory and a fully initialized connection manager at the same time when building an HttpClient instance. Method #setConnectionManager supersedes #setSSLSocketFactory.
Do either this
SSLContext sslContext = SSLContexts.custom().useProtocol("TLSv1.2").build();
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext, new String[] { "TLSv1.2" },
new String[] { "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256" },
SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create()
.setDefaultRequestConfig(requestConfig)
.setSSLSocketFactory(sslsf);
or this
SSLContext sslContext = SSLContexts.custom().useProtocol("TLSv1.2").build();
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext, new String[] { "TLSv1.2" },
new String[] { "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256" },
SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create()
.register("http", PlainConnectionSocketFactory.getSocketFactory())
.register("https", sslsf)
.build();
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create()
.setDefaultRequestConfig(requestConfig)
.setConnectionManager(cm);
Oh yes, one more thing. Please consider upgrading to 4.5

Boghe for wp8 send

I had a problem:
SipCallback callback = new SipCallback();
MySipStack mSipStack = new MySipStack(callback, realm, impi, impu);
MyMessagingSession shortMessageSession = new MyMessagingSession(mSipStack, this.remotePartyUri);
shortMessageSession.SendTextMessage(this.msgtextbox.Text);
shortMessageSession.Dispose();
As described above,i can't send messages and I got the following error:
file: "..\..\..\..\..\..\doubango\branches\2.0\doubango\tinyNET\src\tnet_utils.c"
line: "357"
MSG: Not implemented on your OS
***ERROR: function: "tsip_api_message_send_message()"
file: "..\..\..\..\..\..\doubango\branches\2.0\doubango\tinySIP\src\api\tsip_api_message.c"
line: "69"
MSG: Stack not started.
*INFO: *** SIP Session destroyed ***
How to successfully send a message?
regards

JRuby / Warbler / GlassFish - (NameError) uninitialized constant ApplicationController::SessionsHelper

Really Short Story:
I'm incredibly frustrated by this issue
Short Story:
JRuby-1.7.2 building to a .war using Warbler (1.3.8) deploying to a glassfish v3 server. I can build on my machine and everything works fine, however when I try to build with Jenkins, the war gives the following error when trying to load the first page:
org.jruby.exceptions.RaiseException: (NameError) uninitialized constant ApplicationController::SessionsHelper
Long Story:
Build script on our Jenkins server:
#path to rvm
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
# Use the correct ruby
rvm use "jruby-1.7.2#webadmin"
# Set "fail on error" in bash
set -e
# build
bundle update
warble compiled war
Error log from Glassfish....which I hope has enough info.
[#|2013-05-31T17:10:14.634-0400|INFO|glassfish3.1.2|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=19;_ThreadName=Thread-2;|PWC1412: WebModule[null] ServletContext.log():INFO: pool was empty - getting new application instance|#]
[#|2013-05-31T17:10:25.181-0400|INFO|glassfish3.1.2|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=19;_ThreadName=Thread-2;|PWC1412: WebModule[null] ServletContext.log():An exception happened during JRuby-Rack startup
uninitialized constant ApplicationController::SessionsHelper
--- System
jruby 1.7.4 (1.9.3p392) 2013-05-16 2390d3b on OpenJDK 64-Bit Server VM 1.6.0_27-b27 [linux-amd64]
Time: 2013-05-31 17:10:25 -0400
Server: GlassFish Server Open Source Edition 3.1.2.2
jruby.home: classpath:/META-INF/jruby.home
--- Context Init Parameters:
com.sun.faces.forceLoadConfiguration = true
com.sun.faces.validateXml = true
public.root = /
rails.env = production
--- Backtrace
NameError: uninitialized constant ApplicationController::SessionsHelper
--- RubyGems
Gem.dir: /opt/glassfish3/glassfish/domains/myDomain/applications/web-admin/WEB-INF/gems
Gem.path:
/opt/glassfish3/glassfish/domains/myDomain/applications/web-admin/WEB-INF/gems
Activated gems:
bundler-1.3.5
rake-10.0.4
i18n-0.6.1
multi_json-1.7.4
activesupport-3.2.13
builder-3.0.4
activemodel-3.2.13
erubis-2.7.0
journey-1.0.4
rack-1.4.5
rack-cache-1.2
rack-test-0.6.2
hike-1.2.2
tilt-1.4.1
sprockets-2.2.2
actionpack-3.2.13
mime-types-1.23
polyglot-0.3.3
treetop-1.4.12
mail-2.5.4
actionmailer-3.2.13
arel-3.0.2
tzinfo-0.3.37
activerecord-3.2.13
activeresource-3.2.13
gyoku-1.0.0
nokogiri-1.5.9-java
akami-1.2.0
bcrypt-ruby-3.0.1-java
sass-3.2.9
bootstrap-sass-2.3.1.2
will_paginate-3.0.4
bootstrap-will_paginate-0.0.9
bouncy-castle-java-1.5.0147
coffee-script-source-1.6.2
execjs-1.4.0
coffee-script-2.2.0
rack-ssl-1.3.3
json-1.8.0-java
rdoc-3.12.2
thor-0.18.1
railties-3.2.13
coffee-rails-3.2.2
faker-1.1.2
httpi-2.0.2
jquery-rails-2.2.2
jruby-openssl-0.8.8
nori-2.1.0
rails-3.2.13
sass-rails-3.2.6
wasabi-3.1.0
savon-2.2.0
therubyrhino_jar-1.7.4
therubyrhino-2.0.2
uglifier-1.0.4
uuidtools-2.1.4
--- Bundler
Bundler.bundle_path: /opt/glassfish3/glassfish/domains/myDomain/applications/web-admin/WEB-INF/gems
Bundler.root: /opt/glassfish3/glassfish/domains/myDomain/applications/web-admin/WEB-INF
Gemfile: /opt/glassfish3/glassfish/domains/myDomain/applications/web-admin/WEB-INF/Gemfile
Settings:
gemfile = /opt/glassfish3/glassfish/domains/myDomain/applications/web-admin/WEB-INF/Gemfile
without = development:test:assets
bin_path = /opt/glassfish3/glassfish/domains/myDomain/applications/web-admin/WEB-INF/gems/gems/bundler-1.3.5/bin/bundle
--- JRuby-Rack Config
compat_version =
default_logger = org.jruby.rack.logging.StandardOutLogger#62a49a04
equals =
err = com.sun.common.util.logging.LoggingOutputStream$LoggingPrintStream#7a21bdb8
filter_adds_html = true
filter_verifies_resource = false
ignore_environment = false
initial_memory_buffer_size =
initial_runtimes =
jms_connection_factory =
jms_jndi_properties =
logger = org.jruby.rack.logging.ServletContextLogger#19a2312c
logger_class_name = servlet_context
logger_name = jruby.rack
maximum_memory_buffer_size =
maximum_runtimes =
num_initializer_threads =
out = com.sun.common.util.logging.LoggingOutputStream$LoggingPrintStream#52f8d395
rackup =
rackup_path =
rewindable = true
runtime_arguments =
runtime_environment =
runtime_timeout_seconds =
serial_initialization = false
servlet_context = org.apache.catalina.core.ApplicationContextFacade#16c7e149
throw_init_exception = false
|#]
[#|2013-05-31T17:10:25.182-0400|INFO|glassfish3.1.2|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=19;_ThreadName=Thread-2;|PWC1412: WebModule[null] ServletContext.log():DEBUG: resetting rack response due exception|#]
Turns out it was an issue with source code control. My helpers directory was not added and therefore Jenkins was not including in the build. Always check the obvious first, if it says it isn't there it probably isn't.

Server object error 'ASP 0177 : c0000005'

The full error:
The CreateObject of '(null)' caused exception C0000005.
Server object error 'ASP 0177 : c0000005'
Server.CreateObject Failed
/get.asp, line 35
get.asp - line 35:
Response.Status = "500 Internal Server Error"
set objErr=Server.GetLastError()
Col = objErr.Column
Cat = objErr.Category
Desc = objErr.Description
Fle = objErr.File
Lne = objErr.Line
Num = objErr.Number
Src = objErr.Source
ASPC = objErr.ASPCode
ASPD = objErr.ASPDescription
set SQLCOMM = Server.CreateObject("ADODB.Command") //line 35
SQLCOMM.ActiveConnection = DBConn_Str
SQLCOMM.CommandText = SQLq
SQLCOMM.CommandType = 1
SQLCOMM.CommandTimeout = 0
SQLCOMM.Prepared = true
SQLCOMM.Execute()
set SQLCOMM=Nothing
This script usually works, but for some odd reason it keeps giving this error every now and then lately. The most recent thing i did is make more table/col indexes in the MsSql DB, and i'm not sure why this is now happening. Does anybody know why?
The error is a windows Access Denied error. However what it disturbing is that it is an exception C00000005 rather than an error 80070005. Somewhere between CreateObject and the completion of initialising an ADODB.Command an access denied exception is being raised that isn't caught by normal means.
At this point in code the only thing being "accessed" is the ADODB.dll however its unlikely that this is truely a permissions problem. However if you are using windows integrated security on the site it my be worth seeing if there is a corelation between occurances and the user using the site.