Hello All
I've discovered an issues, which I'm not sure it really is an known issue with the framework or it's due to the versions of Protractor + CucumberJS that I am using, these are:
"cucumber": "~0.7.0",
"protractor": "~2.5.1",
"selenium-standalone": "3.0.0",
I'm using this versions as of today, I know that CucumberJS was separate from Protractor, but since our current project is using Node < 4, I cannot update it.
Having said this, the error that I'm having is when I run the test suite with protractor config.js and the seleniumAddress attribute commented (it starts up a webdriver automatically at random port)
The error that appears, when the suite finishes is:
throw new Error('This driver instance does not have a valid session ID ' +
^
BUT when I run the exact same suite, starting webdriver manually and setting the selenium address, the test passes!!!
The suite contains:
17 scenarios (17 passed)
55 steps (55 passed)
Does anyone knows what could be the reason? My first thought is that starting the server manually it would make webDriver slower, and therefore test actions would be too, so... but I had compared both time executions and there's only 1 second difference between both....
I had realized, that the problem with all is that since I had commented out the seleniumAddress line, Protractor was starting up webDriber-manager automatically, and when I added the line and manually started WebDriver, the error did not happen again. NOT sure what's the matter with it starting up automatically but, in case you ran into the same problem here's the solution!
Thanks
Related
I have a basic selenium script running/deployed on aws lambda.
Chrome and chromedriver and installed as layers (and available on /opt) via serverless.
The script works ... but only some of the time and rarely at scale (invoking more than 5 instances asynchronously).
I invoke the function in a simple for loop (up to about 200 iterations)
response = client.invoke(
FunctionName='arn:aws:lambda:us-east-1:12345667:function:selenium-lambda-dev-hello',
InvocationType='Event', #|'RequestResponse'|'Event' (async)| DryRun'
LogType='Tail',
#ClientContext='string',
Payload=event_payload,
#Qualifier='24'
)
Other runs, the process hangs while initiating the selenium driver on this line
driver = webdriver.Chrome('/opt/chromedriver_89', chrome_options=options)
other iterations the drivers fail/throw a 'timeout waiting for renderer exception'
This I believe is often due to a mismatch of chromedriver/chrome. I have checked and verified my versions are matched up and compatible (and like i said they do work sometimes).
I guess i'm looking for some ideas/direction to even begin to troubleshoot this. I was under the impression that each invokation of a lambda function is in a separate environment, so why would increasing the volume of invokations have any adverse effect on how well my script runs?
Any ideas or thoughts would be greatly appreciated all!
Discussed in the comments.
There's no complete solution but what has helped improve the situation was increasing the memory of the Lambda service.
The alternatives to try/consider:
Don't use Chrome. Use requests and lxml to query the pages via the network level and remove the need for Chrome.
I did something similar to support another stack question recently. You can see it's similar but not quite the same.
Go to a url and get some text from an xpath:
from lxml import html
import requests
import json
url = "https://nonfungible.com/market/history"
response = requests.get(url)
page = html.fromstring(response.content)
datastring = page.xpath('//script[#id="__NEXT_DATA__"]/text()')
Don't use Chrome. Chrome is ideal for functional testing - but if that's not you objective consider using HtmlUnitDriver or phantomjs. Both of these are significantly lighter than chrome and won't require a browser to be installed (you can run it straight from libraries)
You only need to change the driver initialisation and the rest of the script (in theory) should work.
PhantomJS:
$ pip install selenium
$ brew install phantomjs
from selenium import webdriver
driver = webdriver.PhantomJS()
Unit Driver:
from selenium import webdriver
driver = webdriver.Remote(
desired_capabilities=webdriver.DesiredCapabilities.HTMLUNIT)
We have selenium tests in C# running on jenkins. With the latest version of Chrome 75 the tests are starting to fail during execution with the error "Chrome failed to start"
I went through some articles and have implemented the below code as part of my arguments for Chrome.
chromeOptions.AddArgument("--enable-automation");
chromeOptions.AddArgument("--no-sandbox");
chromeOptions.AddArgument("--disable-extensions");
chromeOptions.AddArgument("--disable-print-preview");
chromeOptions.AddArgument("--disable-gpu");
chromeOptions.AddArgument("--disable-software-rasterizer");
chromeOptions.AddArgument("--disable-gpu-sandbox");
chromeOptions.AddArgument("--disable-features=VizDisplayCompositor");
chromeOptions.AddArgument("--start-maximized");
chromeOptions.AddArgument("--disable-dev-shm-usage");
chromeOptions.PageLoadStrategy = PageLoadStrategy.Normal;
This happens during jenkins execution only.
I'm seeing this on Chrome 76. The solution seems to be to remove the --disable-software-rasterizer argument.
I've encountered problems with starting JMeter and WebDriver Set.
I set - Thread Group with:
jp#gc FF Driver Config
jp#gc Web Driver Sampler
View Results in Table
In Web Driver Sampler I have following lines:
WDS.sampleResult.sampleStart()
WDS.browser.get('http://google.com')
WDS.sampleResult.sampleEnd()
And I get following error:
ERROR - jmeter.threads.JMeterThread: Test failed! java.lang.NoClassDefFoundError: Could not initialize class org.apache.http.conn.ssl.SSLConnectionSocketFactory
How can I make it work?
Make sure you use the latest JMeter version (2.13 as for the moment)
Make sure you use the latest WebDriver Set plugin package (1.3.1 as for now)
Make sure you use supported Firefox version
Supports native events for Firefox version 31 (immediately previous ESR).
Native event support has been discontinued for versions of Firefox later
than 33. Synthetic events tested on Firefox versions 31 (immediately
previous ESR), 38 (immediately previous release and current ESR), and 39
(current release).
Before starting JMeter:
go to JMeter's /lib folder
locate .jar files which names start with "http"
delete files which have lesser versions
If you still experience problems check out The WebDriver Sampler: Your Top 10 Questions Answered guide
I have the following in my selenium-webdriver test (the test is written as coffee-script):
#driver = new selenium.Builder()
.withCapabilities(selenium.Capabilities.chrome())
.build()
Yet when I run this test the error I get is:
Error: Failed to install profile; firefox terminated with Result(code=-1073
741819, signal=null)
I am perplexed why its trying to start firefox (there is no reference to firefox in my code). Also, at one point this was working. I am not sure what changed in my laptop which has resulted in this behavior.
Thanks for any help.
I am using the newest version of Selenium RC and firefox 3.5 When I run my test from eclipse I get this error XHR ERROR: Response_Code = -1 Error_Message = Request Error.
Firefox and Selenium RC open up fine, it seems to try to connect to the remote site I want, but then firefox crashes, any ideas?
I'm pretty sure this is an issue fixed in trunk (and will come out in the pending 1.0.4 release). If you download 2.0a5, this includes a 1.0.x compatible Selenium server. You should be able to drop the -standalone JAR in place and have it work. If not, building from trunk is your next best bet.
Alternatively, you could try to modify the open command call. In dynamic languages, such as Ruby, this is fairly straightforward. open() takes a URL and a boolean as its values. You'll want to invert the logic for the second param (I think it's false by default, so you'll want true).