So recently I had compiled the Selenium 2 iPhone WebDriver on Xcode with iOS 5 sdk.
Boy. That was a headache.
The steps were suppose to be easy, looking at : http://code.google.com/p/selenium/wiki/IPhoneDriver
Download XCode, Download the iOS 5 SDK, download the source, run sudo ./go iphone and boom, I should have a working iphone app. Well, there was a patch that landed sunday for the build.desc that fixed an issue with compilation. Not only that, I then tried to get the xcode to compile, I got the following error message:
I found the answer to my issues : ( http://debugfix.com/2011/11/unsupported-compiler-gcc-4-2-selected-for-architecture-i386/ )
“xcode build errors:
Unsupported compiler ‘GCC 4.2′ selected for architecture ‘i386′
This can be caused by importing a project for a pre- iOS 5 SDK into a copy of xcode with iOS 5 SDK only.
To fix, click your Project -> Build Settings. Then under Build Options, there is an entry for Compiler for C/C++/Objective-C. Choose Apple LLVM compiler 3.0.
There is a chance this could effect other aspects of your binaries as you are using a new compiler, so YMMV. That being said, it’s so far caused no issues for me.”
So, I thought I did that for the iphone xcode project, but I still kept getting that error. Why? Little did I see the subproject inside the iphone web driver project… it’s called CocoaHTTPServerLibrary, and that also needs to have the adjustment.
Not only that the build directories when SVN’ed down were owned by root and Xcode didn’t have permission to build into them. So after chmod’ing the build directory recursively down with a nice little sudo chmod -R, I finally got the iPhone Webdriver to compile using the xcode ui interface. Yay. It took a bit of figuring out and playing around with it and searching for the net for some answers.
What else did I get done? Well, not just for the iphone, but I also got Virtual Box up and running with Ubuntu and various other platforms running the webdriver stuff:
- Test on Unix platform (done)
- 1. download/install Virtual Box ( https://www.virtualbox.org/wiki/Downloads )
- 2. download/install Virtual box extension ( http://download.virtualbox.org/virtualbox/4.1.6/Oracle_VM_VirtualBox_Extension_Pack-4.1.6-74713.vbox-extpack )
- 3. download/run Ubuntu Virtual Box : ( http://virtualboxes.org/images/ubuntu/ )
- 4. login ubuntu/reverse
- 5. open terminal (search apps, may want to pin)
- 6. java runtime needed : sudo apt-get install openjdk-7-jre-headless
- 7. python 2.6: 2.7 already installed on vb
- 8. sudo apt-get install python-setuptools ( to get easy_install)
- 9. sudo easy_install pip
- 10. sudo apt-get install git
- 11. make a selenium directory:
- 12. download selenium : http://code.google.com/p/selenium/downloads/list ; selenium-server-standalone-<version>.jar
- 13. git clone https://github.com/zacc/BrowserID-Tests.git
- 14. sudo pip install -r requirements.txt
- optional install :
- a) http://pypi.python.org/pypi/virtualenv ; allows you to have separate environments
- b) git clone https://github.com/mozilla/moz-grid-config ; allows you to do certs
- 15. run server on desktop: java -jar selenium-server-standalone-2.5.0.jar -firefoxProfileTemplate path:firefoxprofilescertificateExceptions
- (note for linux: works; kinda)
- py.test –browsername=”firefox” –browserver=8.0.1 –credentials=./credentials.yaml –platform=linux
- (note for mac: works; kinda)
- py.test –browsername=”firefox” –browserver=8.0.1 –credentials=./credentials.yaml –platform=mac
- (note for chrome: works)
- download chromium driver: http://code.google.com/p/chromium/downloads/list
- Run tests against a local webdriver using Google Chrome:
- py.test –driver=chrome –chromepath=/Applications/chromedriver
- (note for iphone; works kinda)
- py.test –credentials=./credentials.yaml –platform=REMOTE –host=”192.168.15.1″ –port=3001 –browsername=iphone –browserver=8
So ya. This shows you that webdriver, with the py.test can be pretty flexible in which platform you want to run the tests with. The soft blocker that I have right now, is that unfortunately the mobile devices will show different web pages than the desktop, so I believe we may need to split the tests up. In the meantime, I’m busy with other things that I have to test, create, do, etc. so I’m gonna ask for AMO web QA team for some help in regards to portion… And oh… selenium 2 looks hot.
I can’t wait til the Robotium stuff lands for Mobile Fennec!
Note: copy and pasting from wordpress may cause issues with the command line there should be two -’s in the command line not one.
Filed under: Uncategorized