I write the test on Mac and everything works well.
Then I migrated the test script
to server's (ubuntu on Linode) docker container.
The test was failed,
@driver.current_url will show me https://m.flyscoot.com/
but actually I gave the url http://www.flyscoot.com/index.php/en/
to open.
My test was failed by unexpectedly redirected to https://m.flyscoot.com/
I've no idea why this happened?
I guess the web driver was be thought a mobile version browser.
How could I cheat the website so that I can get the identical test result ?
Test failed environment is running on
selenium/node-firefox-debug
andselenium/hub
from this repohttps://github.com/SeleniumHQ/docker-selenium
Dockerfile
FROM selenium/node-firefox-debug
....
CMD ["/bin/bash", "/opt/bin/entry_point.sh"]
docker-compose
hub:
image: selenium/hub
ports:
- 4444:4444
web:
build: .
volumes:
- .:/crawler
ports:
- 5900:5900
links:
- hub:hub
entry_point.sh
#!/bin/bash
# RUN THE CRON JOB
export GEOMETRY="$SCREEN_WIDTH""x""$SCREEN_HEIGHT""x""$SCREEN_DEPTH"
xvfb-run --server-args="$DISPLAY -screen 0 $GEOMETRY -ac +extension RANDR" \
java -jar /opt/selenium/selenium-server-standalone.jar \
-role node \
-hub http://$HUB_1_PORT_4444_TCP_ADDR:$HUB_1_PORT_4444_TCP_PORT/grid/register \
-browser browserName=firefox
--background