-
-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ChromeDriver] Tests failing with invalid session id #468
Comments
How many tests are being run in parallel? (what's the |
@michallepicki it's not set explicitly and I don't know how many cores the CI has off the top of my head and I don't have SSH access edit: |
After changing tests to run with For whoever comes afterwards, a team member also had an issue where this occurred all the time but there the issue was non matching chromedriver/chromium versions. That's decidedly not the case on CI as linux package management enforces matching versions there. WHile our problem seems solved I think I'd like to keep this open because it might still be a problem that's fixable or at least better highlightable in wallaby. |
For the record, the problem popped up again restricting it to I'm unsure what this is. Part of me believes chromedriver just dies. Which is supported by the error I get sometimes being:
|
Small note for future reference: Make sure that your |
I had the same issue as well, however my tests were passing on CI but not local (macOS). |
+1 to @PragTob I had the same issue on GitlabCI and local machine. |
I ran into this issue again locally and would like to recommend to verify that your |
I also ran into this problem and have no clue on how to make chrome+wallaby work on travis ci. Details here. Would love some help. |
I had the same problem in the past, and my fix was what @PJUllrich recommended: make sure Chrome and Chromedriver are at the same version. Here's a bash script that I run as part of my apps' #!/usr/bin/env bash
chromedriver_path=$(command -v chromedriver)
chrome_path="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
chromedriver_version=$("${chromedriver_path}" --version)
chrome_version=$("${chrome_path}" --version)
chromedriver_major_version=$("${chromedriver_path}" --version | cut -f 2 -d " " | cut -f 1 -d ".")
chrome_major_version=$("${chrome_path}" --version | cut -f 3 -d " " | cut -f 1 -d ".")
if [ "${chromedriver_major_version}" == "${chrome_major_version}" ]; then
exit 0
else
echo "Wallaby often fails with 'invalid session id' if Chromedriver and Chrome have different versions."
echo "Chromedriver version: ${chromedriver_version} (${chromedriver_path})"
echo "Chrome version : ${chrome_version} (${chrome_path})"
exit 1
fi
|
@eahanson Thanks for the script it worked great for me! Little update for Linux compatibility in CI:
|
I have the same problem on MacOS X: 11.2.3 (20D91) wallaby 0.28 I have the same version of chromedriver as my browser If there is a script to change please tell me which file to change - (I am relatively new to Phoenix/Elixir and completely new to Wallaby) I followed the setup instructions at: https://www.tddphoenix.com/setting-up/ ✔ ~/devel/learning/germanvelasco/tdd_phoenix/chatter [install_wallaby L|✚ 9…9]
.. Finished in 3.0 seconds Randomized with seed 381981 |
Hi! I'm using Wallaby for scrapping so it failed randomly (with some pages on specific circumstances) From developers.google.com:
So using: Wallaby.start_session(
capabilities: %{
chromeOptions: %{
args: [
"--headless",
"--no-sandbox",
"window-size=1280,800",
"--fullscreen",
"--disable-gpu",
"--disable-dev-shm-usage"
]
}
}
) Worked for me (after lot of suffering). |
In case someone has troubles after the 115 release of chromedriver, here's an amended version of the script from @lpender and @eahanson that works for me #!/usr/bin/env bash
# from https://github.com/elixir-wallaby/wallaby/issues/468#issuecomment-810518368
chromedriver_path=$(command -v chromedriver)
platform="mac-x64"
function get_download_url {
major_version=$1
curl -s curl "https://googlechromelabs.github.io/chrome-for-testing/latest-versions-per-milestone-with-downloads.json" \
| jq -r '.milestones."'$major_version'".downloads.chromedriver | .[] | select(.platform | contains("'$platform'")) | .url'
}
function download_chromedriver {
download_url=$1
curl -s $download_url -o "chromedriver_${platform}.zip"
}
function install_chromedriver_executable {
unzip -oq "chromedriver_${platform}.zip"
sudo mv "chromedriver-${platform}/chromedriver" "/usr/local/bin/chromedriver"
rm "chromedriver_${platform}.zip"
rm -rf "chromedriver-${platform}"
}
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) chrome_path="/usr/bin/google-chrome";;
Darwin*) chrome_path="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome";;
esac
chromedriver_version=$("${chromedriver_path}" --version)
chrome_version=$("${chrome_path}" --version)
chromedriver_major_version=$("${chromedriver_path}" --version | cut -f 2 -d " " | cut -f 1 -d ".")
chrome_major_version=$("${chrome_path}" --version | cut -f 3 -d " " | cut -f 1 -d ".")
if [ "${chromedriver_major_version}" == "${chrome_major_version}" ]; then
echo "Chromedriver matches chrome version ✓"
exit 0
else
echo "Wallaby often fails with 'invalid session id' if Chromedriver and Chrome have different versions."
echo "Chromedriver version: ${chromedriver_version} (${chromedriver_path})"
echo "Chrome version : ${chrome_version} (${chrome_path})"
echo ""
echo "Install latest version? [y/n]"
read install
echo "install = $install"
if [[ "$install" == "y" ]]; then
echo "determining latest chromedriver version under ${chrome_major_version} ..."
url=$(get_download_url $chrome_major_version)
echo "downloading chromedriver version ${chrome_major_version}..."
$(download_chromedriver $url)
echo "installing chromedriver (requires sudo)..."
$(install_chromedriver_executable)
echo "Done :)"
else
exit 1
fi
fi |
Howdy fellow wallabyers!
We have some tests that are stubbornly flaky on CI and sometimes locally and I can't for the live of me figure out why that might be happening.
I couldn't reproduce locally right now but on CI a colleague had to rerun the tests 5 times for them to pass.
Error
Test Code
Multiple tests are randomly failing, one of them being our easiest:
The others are usually simple CRUD tests (app isn't that complex yet) :) Often times 2 of them are failing. Sometimes it's just one.
There is no database access here. Just good old landing page. The session is also piped through from beginning to end so no issues with stale sessions.
Environment
The whole thing reminds me a bit of #221
Any ideas/help/input on how to remedy this would be highly appreciated 👌
The text was updated successfully, but these errors were encountered: