// iOS // Find element in table cell driver.findElementByXPath("//XCUIElementTypeCell/XCUIElementTypeStaticText[@name='some-id']")); // Print source of screen visible System.out.println(driver.getPageSource()); //default timeout for all commands executed using this driver. can be overridden using explicit wait driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS); //EXPLICIT wait for element for x seconds // If explicit wait > implicit wait , then greater driver will default to greater wait period int seconds= 3; WebDriverWait wait = new WebDriverWait(driver, seconds); wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("some-id"))); // UIAutomation(IOS)// Find visibility of element using XPath xpath = "UIATableCell/UIAStaticText[@label='Family'][@visible='true']"; driver.findElementByXPath(xpath); click on first table cell (xpath may change based on your application) xpath("//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]").click
Tejz tech problems solved
Tech Blog updated with solution for latest problems, I encountered with selenium and mobile testing. I professionally specialize in Calabash IOS & Android, Robotium
Thursday 22 September 2016
Helper methods Appium 1.6.0 Beta
2) Migration IOS Appium tests from UIAutomation to XCUITest
Most of the Elements have changed after Instruments have moved form UIAutomation to XCUITest
Hence all references using classnames and xpaths in Appium Automation must be updated to run from Appium 1.6.0 onwards
at the moment its in beta
Look at installation procedure here - http://mytechlifez.blogspot.co.uk/2016/09/appium-1.6.0-beta1-installation-xcode8-ios10.html
UIATableview -> XCUIElementTypeTable
UItableviewcell -> XCUIElementTypeCell
Choose row 1 in a table using xpath-
Hence all references using classnames and xpaths in Appium Automation must be updated to run from Appium 1.6.0 onwards
at the moment its in beta
Look at installation procedure here - http://mytechlifez.blogspot.co.uk/2016/09/appium-1.6.0-beta1-installation-xcode8-ios10.html
Table elements
Table / RowUIATableview -> XCUIElementTypeTable
UItableviewcell -> XCUIElementTypeCell
Choose row 1 in a table using xpath-
"///XCUIElementTypeTable[1]/XCUIElementTypeCell[1]/XCUIElementTypeStaticText[1]"
"//XCUIElementTypeCell[1]/XCUIElementTypeStaticText[1]"
XCUItest iOShttps://discuss.appium.io/t/appium-xcuitest-example-how-to-get-started-appium-using-xcuitest-for-real-device/12415/4//Migrating from UIAutomation to XCUItestUIAButton changes into XCUIElementTypeButton UIA*** --> XCUIElementType*** UIAStaticText -> XCUIElementTypeStaticText UIATableView -> XCUIElementTypeTable UIANavigationBar -> XCUIElementTypeNavigationBar
Buttons
"UIABUtton" is replaced by "XCUIElementTypeButton"
1) Appium 1.6.0 beta1 Installation
I have managed to run my IOS tests on XCUItest using below changes.
Elements have to migrated from UIA to XCUI elements
Inorder to run appium on 1.6.0 beta 1 for ios 10 and xcode 8
use below settings
[caps]
platformName = "iOS"
orientation = "PORTRAIT"
platformVersion = "10.0"
deviceName ="iPhone Simulator"
noReset = "false"
automationName = "xcuitest"
appiumVersion = "1.6.0-beta1"
app="<app_path>/<app_name>.app"
[appium_lib]
Installation
npm uninstall appium
npm install appium@1.6.0-beta1
npm install -g appium-xcuitest-driver
Install carthage dependency manager
Error : Fetching dependencies\nPlease make sure that you have Carthage installed (https://github.com/Carthage/Carthage)\nNote: We are expecting that carthage installed in /usr/local/bin/\n',
Solution : brew install carthage
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEmEeNYP4-wmacF0FOv-hkMGPiywyp22QWXBTASmYu4aPjUxQFI5EYkcmkYkD-pjZHSZMEaj_CtCvwpnE8RuiUxkBDn7snYZIfor2S3ndtX-gF6LxRRjGc3yn28hXYoe9oHp9os3i_oOM/s320/4+cartage+error.png)
Elements have to migrated from UIA to XCUI elements
Inorder to run appium on 1.6.0 beta 1 for ios 10 and xcode 8
use below settings
[caps]
platformName = "iOS"
orientation = "PORTRAIT"
platformVersion = "10.0"
deviceName ="iPhone Simulator"
noReset = "false"
automationName = "xcuitest"
appiumVersion = "1.6.0-beta1"
app="<app_path>/<app_name>.app"
[appium_lib]
Installation
npm uninstall appium
npm install appium@1.6.0-beta1
npm install -g appium-xcuitest-driver
brew install carthage
Install carthage dependency manager
Error : Fetching dependencies\nPlease make sure that you have Carthage installed (https://github.com/Carthage/Carthage)\nNote: We are expecting that carthage installed in /usr/local/bin/\n',
Solution : brew install carthage
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEmEeNYP4-wmacF0FOv-hkMGPiywyp22QWXBTASmYu4aPjUxQFI5EYkcmkYkD-pjZHSZMEaj_CtCvwpnE8RuiUxkBDn7snYZIfor2S3ndtX-gF6LxRRjGc3yn28hXYoe9oHp9os3i_oOM/s320/4+cartage+error.png)
Xcode 8 Installation :
download xcode
unzip the xcode file
Rename old /Applications/Xcode.app to /Applications/Xcode7.app(incase you still want to keep it)
Drag new Xcode app to /Applications/Xcode.app
Open Xcode and install it
Other fixes:
If you encounter issues check here - https://github.com/appium/appium/issues/6853
I had to manually run bootstrap as mentioned in above link
cd ~/.npm-global/lib/node_modules/appium-xcuitest-driver/WebDriverAgent
sh Scripts/bootstrap.sh
To Properly install node check this link - https://github.com/sindresorhus/guides/blob/master/npm-global-without-sudo.md
Saturday 7 September 2013
(completed)Calabash IOS & Android online QA - Free session 21 & 28 Sep 2013
Hi All,
I am planning to conduct 2 live sessions to help my youtube audience get up to speed with calabash IOS & Android
If you are interested please add me (automationtutorial@gmail.com) on google plus
Youtube Channel Link - http://www.youtube.com/tejasv2
Overview of sessions
(CONFIRMED)
This will be an online session on Google hangout
Thanks,
Tej
I am planning to conduct 2 live sessions to help my youtube audience get up to speed with calabash IOS & Android
If you are interested please add me (automationtutorial@gmail.com) on google plus
Youtube Channel Link - http://www.youtube.com/tejasv2
Overview of sessions
(CONFIRMED)
21 Sep 2013 - Calabash IOS session ( 1- 1.5 hours)
Timings : 10 AM UK time ( 2-30 PM Indian Time)
Contents:
How to write step definitions using calabash
How to run queries
30 mins QA session
(Tentative)
28 Sep 2013 - Calabash Android session ( 1- 1.5 hours)
28 Sep 2013 - Calabash Android session ( 1- 1.5 hours)
Timings : 10 AM UK time ( 2-30 PM Indian Time)
Contents:
How to write step definitions using calabash
How to run queries
30 mins QA sessionThis will be an online session on Google hangout
Thanks,
Tej
Friday 30 August 2013
Calabash IOS ruby installation (rvm) error and solution
echo progress-bar >> ~/.curlrc
execute command to install rvm with latest ruby:
\curl -L https://get.rvm.io | bash -s stable --ruby
Add below line into ~/.bash_profile
#RVM
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
Check calabash installation
calabash-ios console
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:777:in `report_activate_error': Could not find RubyGem json (>= 0) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:211:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:246:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:1056:in `gem'
from /usr/bin/calabash-ios:18
install this command and you may see below error
sudo gem install json
unable to convert "\xCF" from ASCII-8BIT to UTF-8 for lib/json/ext/generator.bundle,
sudo gem update --system
sudo gem install rdoc
execute command to install rvm with latest ruby:
\curl -L https://get.rvm.io | bash -s stable --ruby
Add below line into ~/.bash_profile
#RVM
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
Check calabash installation
calabash-ios console
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:777:in `report_activate_error': Could not find RubyGem json (>= 0) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:211:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:246:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:1056:in `gem'
from /usr/bin/calabash-ios:18
install this command and you may see below error
sudo gem install json
sudo gem update --system
sudo gem install rdoc
Monday 5 August 2013
Reading plist file using ruby : useful for calabash IOS Automation
#!/usr/bin/ruby -w
# encoding: utf-8
require 'plist'
def read_plist(plist_file)
result=Plist::parse_xml(plist_file)
i=0
result.each { |k, v|
i=i+1
puts k
puts v
puts
}
end
read_plist("features/dump/test.plist")
# encoding: utf-8
require 'plist'
def read_plist(plist_file)
result=Plist::parse_xml(plist_file)
i=0
result.each { |k, v|
i=i+1
puts k
puts v
puts
}
end
read_plist("features/dump/test.plist")
Sample plist file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Language</key>
<string>Svenska</string>
<key>Version</key>
<integer>4</integer>
</dict>
</plist>
very useful while readings strings for localisation (calabash)
Saturday 18 May 2013
Get rid of facetime, misson control from mac on every start in 3 steps
Step 1) cd /Library/Preferences
Step 2) sudo vi com.apple.dockfixup.plist
Step 3) Locate unwanted startup items and remove them , save the file and exit it and restart ur machine
Happy 'mac'ing
<dict>
<key>after</key>
<string>begin</string>
<key>path</key>
<string>/Applications/Mission Control.app</string>
<key>tile-data</key>
<dict>
<key>file-type</key>
<integer>169</integer>
</dict>
</dict>
<dict>
<key>after</key>
<string>/Applications/Mission Control.app</string>
<key>path</key>
<string>/Applications/App Store.app</string>
</dict>
<dict>
<key>after</key>
<string>end</string>
<key>group</key>
<integer>80</integer>
<key>path</key>
<string>/Applications/Server.app</string>
<key>server</key>
<true/>
</dict>
<dict>
<key>after</key>
<string>/Applications/iChat.app</string>
<key>path</key>
<string>/Applications/FaceTime.app</string>
</dict>
Step 2) sudo vi com.apple.dockfixup.plist
Step 3) Locate unwanted startup items and remove them , save the file and exit it and restart ur machine
Happy 'mac'ing
<dict>
<key>after</key>
<string>begin</string>
<key>path</key>
<string>/Applications/Mission Control.app</string>
<key>tile-data</key>
<dict>
<key>file-type</key>
<integer>169</integer>
</dict>
</dict>
<dict>
<key>after</key>
<string>/Applications/Mission Control.app</string>
<key>path</key>
<string>/Applications/App Store.app</string>
</dict>
<dict>
<key>after</key>
<string>end</string>
<key>group</key>
<integer>80</integer>
<key>path</key>
<string>/Applications/Server.app</string>
<key>server</key>
<true/>
</dict>
<dict>
<key>after</key>
<string>/Applications/iChat.app</string>
<key>path</key>
<string>/Applications/FaceTime.app</string>
</dict>
Subscribe to:
Posts (Atom)