简体   繁体   中英

Moving tests from windows to Linux server - Selenium

I have some tests, I am using

  • Maven 3.1
  • Selenide v3.5
  • Selenium v2.53
  • Firefox v45.0.1

I run them on windows and all thing are going fine with successful run, I noticed that browser on windows is explicitly open and see the tests directly on browser.

Then I need to move this to run it on UBUNTU server, I just used Xvfb and try to run the tests. My notice:

  1. I can't see the graphical browser, I search for this thing and it is called a headless browser.
  2. I got different problems with tests, some of them couldn't have a successful test and others can't find some elements! although it is worked on Windows.

My questions, what are the main points we have to consider while moving our test from windows client environment to Linux server?

I am reading about headless browsers, could I have to use one of them? or Selenium can handle this issue.

What are changes in code have to consider to run tests on server? Or the same code should work fine on both environments?

You can use PhantomJS (headless browser). It is better than HTMLUnit Driver. See this link for a better understanding. http://www.guru99.com/selenium-with-htmlunit-driver-phantomjs.html

You can download files for Linux from here http://phantomjs.org/download.html

Just like your Chrome or Firefox Drivers, you can use the PhantomJS (or htmlUnit Driver). They are specifically for OS systems that do not have a GUI or browser.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM