Recently I was going to learn Ruby, and also to try to Appium
Then configure the environment
OS X comes with Ruby, so the installation saves
But also to install the next bundler, in my big celestial, gem install bundle may not find the bundle error, local area network, try several times. No, just the last agent.
Install bundler:gem install bundle
Install Gems:bundle update
Well, it's ready.
Run One Xia Guan The example program of the net
At present, Appium seems to support only 7.1
Yesterday, the hands of a cheap upgrade to the next Xcode to 6.0, looked for the next seemingly no solution found.
Have to revert back to the lower version
Ruby SIMPLE_TEST.RB successfully started the simulator and ran the TestApp. So the IOS environment is ready.
#GETTING STARTED# -----------------#This documentation are intended to show what you get started with a#Simple Appium & appium_lib Test. This example is written without a specific#testing framework in mind; You can use the Appium_lib on the any framework.##Installing RVM# --------------#If you don't have RVM installed, run the following terminal command##\curl-l Https://get.rvm.io | bash-s stable--ruby##Installing GEMS# ---------------#Then , change to the example directory:#CD Appium-location/sample-code/examples/ruby##and install the required gems with bundler by doing:#Bundle Install##RUNNING the TESTS# -----------------#to run the tests, make sure appium are running in another terminal#window, then from the same windows used for the above commands, type##bundle exec Ruby simple_test.rb##It'll take a while, but once it's done should get nothing but a line#telling you "Tests succeeded"; You'll see the IOS Simulator cranking away#doing actions while we ' re running.Require'RubyGems'require'Appium_lib'App_path='/users/zhangminjie/documents/appiumtest2/apps/testapp/build/release-iphonesimulator/testapp.app'Desired_caps={caps: {platformname:'IOS', versionnumber:'7.1', DeviceName:'IPhone Simulator', App:app_path,}, Appium_lib: {sauce_username:nil,#don ' t run on SauceSauce_access_key:nil}}#Start the driverAppium::D river.new (desired_caps). Start_drivermodule Calculator Module IOS#Add all Appium library methods to Test #calling them look nicer.appium.promote_singleton_appium_methods Calculator#ADD Numbersvalues = [Rand], rand (10)] Expected_sum= Values.reduce (&:+) #Find every TextField.elements =textfields Elements.each_with_index do|element, index|Element.type Values[index] End#Click The first buttonButton (1). Click#get the first static text field, then get its textActual_sum =First_text.textRaiseUnless actual_sum = =(expected_sum.to_s)#Alerts is visiblebutton'Show Alert'). Click Find_element:class_name,'Uiaalert' #Elements can found By:class_name #wait for alert to showWait {text'This alert was so cool' } #Or by FindFind'Cancel'). Click#Waits until alert doesn ' t existWait_true {!exists {tag ('Uiaalert') } } #Alerts can switched intobutton'Show Alert'). Click#Get a button by its textAlert = Driver.switch_to.alert#Get The text of the current alert, using #The Selenium::webdriver directlyAlerting_text =Alert.textRaiseException unless Alerting_text.include?'Cool title'alert_accept#Accept The current alert #Window Size is easy to getSizes =window_sizeRaiseException unless sizes.height = = 568RaiseException unless sizes.width = = 320#Quit When you ' re done!Driver_quit puts'Tests succeeded!'EndEnd
Android is simple, installed Android Simulator, launch Android simulator
' Appium_lib ' caps = {caps: 'Android'. UI. Conversationlist'com.android.mms', devicename:' Android Emulator ' }, = Appium::D river.new (Caps). Start_driver
Successful launch of SMS application, it is pull through
It's very important for me to have this kind of English residue Chinese information.
Http://appium.io/slate/cn/v1.2.0/?ruby#appium
Http://www.cnblogs.com/nbkhic/p/3804637.html
Ruby Appium Prep Environment