SlideShare a Scribd company logo
11th Meetup
18 July 2019
DBS, Singapore
Good practices for
debugging Selenium
and Appium tests
Abhijeet Vaikar
Senior Software Engineer Test @ Carousell
Co-organizer @ taqelah!
Testing web and mobile apps since 7 years
LinkedIn: https://www.linkedin.com/in/abhijeetvaikar/
Twitter: https://twitter.com/AbhijeetVaikar
Poll Time
Testing is a process of
Learning, Discovering, Exploring, Analysing a
system.
Automated testing, thus is
also a process of
Learning, Discovering, Exploring, Analysing a
system
where the system is:
● the AUT
● and your test code too!
Typical iteration of an automated UI test
Local Execution
● Running test locally
● Verifying it works fine
● Fix if it breaks
Continuous
Integration
● Run the test along with
other tests on a CI
server against an
in-house device farm
or a cloud provider
● Analyse test runs
Test Authoring and
Prototyping
● Acceptance Criteria
● Inspecting the UI
● Creating UI locators
● Writing the test code
● Adding assertions
Pass
Automated Test
Fail
What failed?
Why it failed?
Where it failed?
When it failed?
A tester’s reactions to each iteration
Authoring
Local Execution
CI execution
What
failed?
Where it
failed?
When it
failed?
Why it
failed? DEBUGGING!
Good practices for debugging Selenium and Appium tests
Sources of debugging your Selenium/Appium code
● UI Inspectors and browser dev tools for debugging locators
● REPL tools for trying out Selenium/Appium client commands
● Debuggers in your IDE
● Test execution logs
● Selenium/Appium server logs
● Javascript console logs in browser
● Logs produced by native mobile apps
● Network logs
UI Inspectors and browser dev tools for
debugging locators
Appium Desktop for UI inspection
What can you do with Appium desktop?
● Inspect the UI hierarchy interactively
● Design and try out locators with different strategies
● Swipe by coordinates
● Tap by coordinates
● Record actions and convert them to script in the language of your choice
(Javascript, Java-JUnit, Ruby, Python, Robot framework) along with boiler
plate code
● Copy the XML UI hierarchy source which you can then inspect
● (New) Actions tab to execute device and session based actions
Macaca Inspector
https://macacajs.github.io/app-inspector/
Web based UI
inspector for both
iOS and Android
platforms
Android specific: UiAutomator Viewer
iOS specific: XCode’s Accessibility inspector
Want more?
Chrome dev tools
● Ctrl + F and paste your locator to evaluate
● Hit $x(“//*your-xpath-here”) in the console to evaluate a xpath
● Hit $(“your-css-selector”) in the console to evaluate a css selector
● Cheat sheets are your best friends (preferably avoid browser plugins that generate xpath/css selectors for
you):
https://www.red-gate.com/simple-talk/development/dotnet-development/xpath-css-dom-and-selenium-the-r
osetta-stone/
REPL tools for debugging
Selenium/Appium client commands
JShell - The REPL for Java (Since Java 9)
https://www.linkedin.com/pulse/test-automation-selenium-webdriver-java-cli-via-jshell-nir-tal/
You can also use the
evaluate expression
feature in IDEs like
Eclipse/IntelliJ
WebDriverIO REPL (Javascript) - for both Selenium and Appium
https://webdriver.io/docs/repl.html
from selenium import webdriver
browser = webdriver.Firefox()
browser.get('http://seleniumhq.org/'
)
Python shell - REPL for Python
Python being an interpreter, you can run each line of code separately in
Python shell
https://pypi.org/project/selenium/
Ruby
Build your own REPL for Selenium/Appium:
http://elementalselenium.com/tips/11-build-an-interactive-prompt
ARC (Appium Ruby Console):
https://github.com/appium/ruby_console
NodeJS
Appium REPL:
https://www.npmjs.com/package/appium-repl
Debuggers in your IDE
What do you prefer?
System.out.println("I'm here");
System.out.println("Inside the function");
System.out.println("Outside the loop");
Imagine debugging across
multiple classes by adding print
statements!
How to use a debugger - 101
1. Add a breakpoint against the
line of code you want to start
debugging from
2. Execute your test runner in
Debug mode
SAGE MODE ACTIVATED
● Step Over
● Step Into
● Force Step Into
● Step Out
● Evaluate Expression
● Resume normal execution
● Inspect all variables/objects
https://naruto.fandom.com/wiki/Sage_Mode
Test execution logs
Use Logging libraries instead of:
● System.out.println() - Java
● Console.log() - Javascript/NodeJS
● print() - Python
● Puts - Ruby
Test execution logs as a source for debugging test runs:
● Useful to understand what happened in your test
● Logs can be used for generating test reports
Why use a logging framework for your tests?
● Customized output - Easy formatting
● Logging levels (INFO, WARN, ERROR, DEBUG, TRACE)
● Can easily switch it on or off based on requirement
● Ability to persist log output on various storage
mechanisms (file, database)
● System.out.println() is an I/O operation
Examples
LOG.info("Initialising WebDriver on cloud provider: {}" ,
configuration. getCloudProvider ().toUpperCase());
LOG.info("TEST PASSED");
catch (WebDriverException e) {
LOG.error("Error creating web driver" , e);
System.exit(1);
}
LOG.warn("API call failed. Retrying again" );
LOG.warn("Unable to write the report json file : {}" ,
e);
Info - Logging important information
Error - Something went very wrong
Warn - Unstable but can be recovered
LOG.debug("Dismissing alert {}" , alert)
Debug - Information only meant for debugging purpose
Selenium/Appium server logs
Selenium WebDriver logs
System.setProperty("webdriver.chrome.logfile" , "D:chromedriver.log" );
System.setProperty("webdriver.chrome.verboseLogging" , "true");
System.setProperty(FirefoxDriver. SystemProperty .DRIVER_USE_MARIONETTE ,"true");
System.setProperty(FirefoxDriver. SystemProperty .BROWSER_LOGFILE ,"C:templogs.t
xt");
Appium server logs
--log /path/to/appium.log
Server argument (When you start appium server)
LogEntries logEntries =
driver.manage().logs().get("server”);
Programmatically
Javascript console logs in browser
How to keep Chrome dev tools open while you are
debugging your Selenium test locally
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-extensions" );
options.addArguments("--auto-open-devtools-for-tabs" );
driver = new ChromeDriver(options);
How to fetch browser console logs (including errors)
programmtically
LogEntries logEntries =
driver.manage().logs().get(LogType.BROWSER);
Logs produced by native mobile apps
Fetching ADB logs for Android device for debugging
List<LogEntry> logEntries =
driver.manage().logs().get("logcat").getAll();
Fetching iOS device logs
● idevicesyslog tool from the command line for real iOS Device
● Console app on MacOS to read console log from simulator
Network Logs
MITMProxy - free and open source HTTPS
proxy
MITMProxy Java - A java wrapper for MITM
Proxy
Fiddler for Windows and MacOS
What techniques or practices do
you follow to debug your
automation scripts?
Please share!
Thank you!
Ad

More Related Content

What's hot (20)

Criando uma grid para execução de testes paralelo com Appium
Criando uma grid para execução de testes paralelo com AppiumCriando uma grid para execução de testes paralelo com Appium
Criando uma grid para execução de testes paralelo com Appium
Elias Nogueira
 
Loom promises: be there!
Loom promises: be there!Loom promises: be there!
Loom promises: be there!
Jean-Francois James
 
Grokking Techtalk #46: Lessons from years hacking and defending Vietnamese banks
Grokking Techtalk #46: Lessons from years hacking and defending Vietnamese banksGrokking Techtalk #46: Lessons from years hacking and defending Vietnamese banks
Grokking Techtalk #46: Lessons from years hacking and defending Vietnamese banks
Grokking VN
 
오픈 소스 도구를 활용한 성능 테스트 방법 및 사례
오픈 소스 도구를 활용한 성능 테스트 방법 및 사례오픈 소스 도구를 활용한 성능 테스트 방법 및 사례
오픈 소스 도구를 활용한 성능 테스트 방법 및 사례
MinWoo Byeon
 
Test at Scale within your Internal Networks with BrowserStack Local Testing
Test at Scale within your Internal Networks with BrowserStack Local TestingTest at Scale within your Internal Networks with BrowserStack Local Testing
Test at Scale within your Internal Networks with BrowserStack Local Testing
BrowserStack
 
The Future of AI-Based Test Automation
The Future of AI-Based Test AutomationThe Future of AI-Based Test Automation
The Future of AI-Based Test Automation
Applitools
 
Grokking TechTalk #33: High Concurrency Architecture at TIKI
Grokking TechTalk #33: High Concurrency Architecture at TIKIGrokking TechTalk #33: High Concurrency Architecture at TIKI
Grokking TechTalk #33: High Concurrency Architecture at TIKI
Grokking VN
 
Cross browser testing with browser stack
Cross browser testing with browser stackCross browser testing with browser stack
Cross browser testing with browser stack
Denys Poloka
 
Introduction to API Security - Intergalactic
Introduction to API Security - IntergalacticIntroduction to API Security - Intergalactic
Introduction to API Security - Intergalactic
Postman
 
Easy Setup for Parallel Test Execution with Selenium Docker
Easy Setup for Parallel Test Execution with Selenium DockerEasy Setup for Parallel Test Execution with Selenium Docker
Easy Setup for Parallel Test Execution with Selenium Docker
Sargis Sargsyan
 
Integration using Apache Camel and Groovy
Integration using Apache Camel and GroovyIntegration using Apache Camel and Groovy
Integration using Apache Camel and Groovy
Claus Ibsen
 
Kong API
Kong APIKong API
Kong API
Patrick Pierson
 
How We NOW Test Software at Microsoft
How We NOW Test Software at MicrosoftHow We NOW Test Software at Microsoft
How We NOW Test Software at Microsoft
TechWell
 
Postman
PostmanPostman
Postman
Igor Shubovych
 
WSO2 Identity Server - Product Overview
WSO2 Identity Server - Product OverviewWSO2 Identity Server - Product Overview
WSO2 Identity Server - Product Overview
WSO2
 
Apache jMeter
Apache jMeterApache jMeter
Apache jMeter
NexThoughts Technologies
 
Ecommerce Website Testing Checklist
Ecommerce Website Testing ChecklistEcommerce Website Testing Checklist
Ecommerce Website Testing Checklist
precisetestingsolution
 
Api testing
Api testingApi testing
Api testing
Keshav Kashyap
 
Postman과 Newman을 이용한 RestAPI 테스트 자동화 가이드
Postman과 Newman을 이용한 RestAPI 테스트 자동화 가이드 Postman과 Newman을 이용한 RestAPI 테스트 자동화 가이드
Postman과 Newman을 이용한 RestAPI 테스트 자동화 가이드
SangIn Choung
 
Introduction to performance testing
Introduction to performance testingIntroduction to performance testing
Introduction to performance testing
Tharinda Liyanage
 
Criando uma grid para execução de testes paralelo com Appium
Criando uma grid para execução de testes paralelo com AppiumCriando uma grid para execução de testes paralelo com Appium
Criando uma grid para execução de testes paralelo com Appium
Elias Nogueira
 
Grokking Techtalk #46: Lessons from years hacking and defending Vietnamese banks
Grokking Techtalk #46: Lessons from years hacking and defending Vietnamese banksGrokking Techtalk #46: Lessons from years hacking and defending Vietnamese banks
Grokking Techtalk #46: Lessons from years hacking and defending Vietnamese banks
Grokking VN
 
오픈 소스 도구를 활용한 성능 테스트 방법 및 사례
오픈 소스 도구를 활용한 성능 테스트 방법 및 사례오픈 소스 도구를 활용한 성능 테스트 방법 및 사례
오픈 소스 도구를 활용한 성능 테스트 방법 및 사례
MinWoo Byeon
 
Test at Scale within your Internal Networks with BrowserStack Local Testing
Test at Scale within your Internal Networks with BrowserStack Local TestingTest at Scale within your Internal Networks with BrowserStack Local Testing
Test at Scale within your Internal Networks with BrowserStack Local Testing
BrowserStack
 
The Future of AI-Based Test Automation
The Future of AI-Based Test AutomationThe Future of AI-Based Test Automation
The Future of AI-Based Test Automation
Applitools
 
Grokking TechTalk #33: High Concurrency Architecture at TIKI
Grokking TechTalk #33: High Concurrency Architecture at TIKIGrokking TechTalk #33: High Concurrency Architecture at TIKI
Grokking TechTalk #33: High Concurrency Architecture at TIKI
Grokking VN
 
Cross browser testing with browser stack
Cross browser testing with browser stackCross browser testing with browser stack
Cross browser testing with browser stack
Denys Poloka
 
Introduction to API Security - Intergalactic
Introduction to API Security - IntergalacticIntroduction to API Security - Intergalactic
Introduction to API Security - Intergalactic
Postman
 
Easy Setup for Parallel Test Execution with Selenium Docker
Easy Setup for Parallel Test Execution with Selenium DockerEasy Setup for Parallel Test Execution with Selenium Docker
Easy Setup for Parallel Test Execution with Selenium Docker
Sargis Sargsyan
 
Integration using Apache Camel and Groovy
Integration using Apache Camel and GroovyIntegration using Apache Camel and Groovy
Integration using Apache Camel and Groovy
Claus Ibsen
 
How We NOW Test Software at Microsoft
How We NOW Test Software at MicrosoftHow We NOW Test Software at Microsoft
How We NOW Test Software at Microsoft
TechWell
 
WSO2 Identity Server - Product Overview
WSO2 Identity Server - Product OverviewWSO2 Identity Server - Product Overview
WSO2 Identity Server - Product Overview
WSO2
 
Postman과 Newman을 이용한 RestAPI 테스트 자동화 가이드
Postman과 Newman을 이용한 RestAPI 테스트 자동화 가이드 Postman과 Newman을 이용한 RestAPI 테스트 자동화 가이드
Postman과 Newman을 이용한 RestAPI 테스트 자동화 가이드
SangIn Choung
 
Introduction to performance testing
Introduction to performance testingIntroduction to performance testing
Introduction to performance testing
Tharinda Liyanage
 

Similar to Good practices for debugging Selenium and Appium tests (20)

Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium Successfully
SpringPeople
 
Android UI Testing with Appium
Android UI Testing with AppiumAndroid UI Testing with Appium
Android UI Testing with Appium
Luke Maung
 
OWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA TestersOWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA Testers
Javan Rasokat
 
automation framework
automation frameworkautomation framework
automation framework
ANSHU GOYAL
 
Java Test Automation for REST, Web and Mobile
Java Test Automation for REST, Web and MobileJava Test Automation for REST, Web and Mobile
Java Test Automation for REST, Web and Mobile
Elias Nogueira
 
Leveraging Playwright for API Testing.pdf
Leveraging Playwright for API Testing.pdfLeveraging Playwright for API Testing.pdf
Leveraging Playwright for API Testing.pdf
Steve Wortham
 
Slides for Automation Testing or End to End testing
Slides for Automation Testing or End to End testingSlides for Automation Testing or End to End testing
Slides for Automation Testing or End to End testing
SwapnilNarayan
 
Using protractor to build automated ui tests
Using protractor to build automated ui testsUsing protractor to build automated ui tests
Using protractor to build automated ui tests
🌱 Dale Spoonemore
 
Selenium
SeleniumSelenium
Selenium
husnara mohammad
 
How to kill test flake in appium
How to kill test flake in appiumHow to kill test flake in appium
How to kill test flake in appium
Gaurav Singh
 
jDriver Presentation
jDriver PresentationjDriver Presentation
jDriver Presentation
freelancer_testautomation
 
Pragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptPragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScript
davejohnson
 
Selenium
SeleniumSelenium
Selenium
Sun Technlogies
 
Selenium Testing with TestingBot.com
Selenium Testing with TestingBot.comSelenium Testing with TestingBot.com
Selenium Testing with TestingBot.com
testingbot
 
Automated Testing using JavaScript
Automated Testing using JavaScriptAutomated Testing using JavaScript
Automated Testing using JavaScript
Simon Guest
 
Testing Ajax Web Applications
Testing Ajax Web ApplicationsTesting Ajax Web Applications
Testing Ajax Web Applications
Ted Husted
 
Continuous Integration, Deploy, Test From Beginning To End 2014
Continuous Integration, Deploy, Test From Beginning To End 2014Continuous Integration, Deploy, Test From Beginning To End 2014
Continuous Integration, Deploy, Test From Beginning To End 2014
Clever Moe
 
Sakai10 Selenium Workshop
Sakai10 Selenium WorkshopSakai10 Selenium Workshop
Sakai10 Selenium Workshop
coreyjack
 
QA Fest 2014. Ярослав Пернеровский. Appium - два в одном. рецепт приготовлени...
QA Fest 2014. Ярослав Пернеровский. Appium - два в одном. рецепт приготовлени...QA Fest 2014. Ярослав Пернеровский. Appium - два в одном. рецепт приготовлени...
QA Fest 2014. Ярослав Пернеровский. Appium - два в одном. рецепт приготовлени...
QAFest
 
Amit (Automation Testing)
Amit (Automation Testing)Amit (Automation Testing)
Amit (Automation Testing)
AMIT SINGH
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium Successfully
SpringPeople
 
Android UI Testing with Appium
Android UI Testing with AppiumAndroid UI Testing with Appium
Android UI Testing with Appium
Luke Maung
 
OWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA TestersOWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA Testers
Javan Rasokat
 
automation framework
automation frameworkautomation framework
automation framework
ANSHU GOYAL
 
Java Test Automation for REST, Web and Mobile
Java Test Automation for REST, Web and MobileJava Test Automation for REST, Web and Mobile
Java Test Automation for REST, Web and Mobile
Elias Nogueira
 
Leveraging Playwright for API Testing.pdf
Leveraging Playwright for API Testing.pdfLeveraging Playwright for API Testing.pdf
Leveraging Playwright for API Testing.pdf
Steve Wortham
 
Slides for Automation Testing or End to End testing
Slides for Automation Testing or End to End testingSlides for Automation Testing or End to End testing
Slides for Automation Testing or End to End testing
SwapnilNarayan
 
Using protractor to build automated ui tests
Using protractor to build automated ui testsUsing protractor to build automated ui tests
Using protractor to build automated ui tests
🌱 Dale Spoonemore
 
How to kill test flake in appium
How to kill test flake in appiumHow to kill test flake in appium
How to kill test flake in appium
Gaurav Singh
 
Pragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptPragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScript
davejohnson
 
Selenium Testing with TestingBot.com
Selenium Testing with TestingBot.comSelenium Testing with TestingBot.com
Selenium Testing with TestingBot.com
testingbot
 
Automated Testing using JavaScript
Automated Testing using JavaScriptAutomated Testing using JavaScript
Automated Testing using JavaScript
Simon Guest
 
Testing Ajax Web Applications
Testing Ajax Web ApplicationsTesting Ajax Web Applications
Testing Ajax Web Applications
Ted Husted
 
Continuous Integration, Deploy, Test From Beginning To End 2014
Continuous Integration, Deploy, Test From Beginning To End 2014Continuous Integration, Deploy, Test From Beginning To End 2014
Continuous Integration, Deploy, Test From Beginning To End 2014
Clever Moe
 
Sakai10 Selenium Workshop
Sakai10 Selenium WorkshopSakai10 Selenium Workshop
Sakai10 Selenium Workshop
coreyjack
 
QA Fest 2014. Ярослав Пернеровский. Appium - два в одном. рецепт приготовлени...
QA Fest 2014. Ярослав Пернеровский. Appium - два в одном. рецепт приготовлени...QA Fest 2014. Ярослав Пернеровский. Appium - два в одном. рецепт приготовлени...
QA Fest 2014. Ярослав Пернеровский. Appium - два в одном. рецепт приготовлени...
QAFest
 
Amit (Automation Testing)
Amit (Automation Testing)Amit (Automation Testing)
Amit (Automation Testing)
AMIT SINGH
 
Ad

More from Abhijeet Vaikar (7)

Unit testing (Exploring the other side as a tester)
Unit testing (Exploring the other side as a tester)Unit testing (Exploring the other side as a tester)
Unit testing (Exploring the other side as a tester)
Abhijeet Vaikar
 
End-end tests as first class citizens - SeleniumConf 2020
End-end tests as first class citizens - SeleniumConf 2020End-end tests as first class citizens - SeleniumConf 2020
End-end tests as first class citizens - SeleniumConf 2020
Abhijeet Vaikar
 
Breaking free from static abuse in test automation frameworks and using Sprin...
Breaking free from static abuse in test automation frameworks and using Sprin...Breaking free from static abuse in test automation frameworks and using Sprin...
Breaking free from static abuse in test automation frameworks and using Sprin...
Abhijeet Vaikar
 
Upgrading Mobile Tester's Weapons with Advanced Debugging
Upgrading Mobile Tester's Weapons with Advanced DebuggingUpgrading Mobile Tester's Weapons with Advanced Debugging
Upgrading Mobile Tester's Weapons with Advanced Debugging
Abhijeet Vaikar
 
Mongo DB 102
Mongo DB 102Mongo DB 102
Mongo DB 102
Abhijeet Vaikar
 
MongoDB 101
MongoDB 101MongoDB 101
MongoDB 101
Abhijeet Vaikar
 
Selenium Overview
Selenium OverviewSelenium Overview
Selenium Overview
Abhijeet Vaikar
 
Unit testing (Exploring the other side as a tester)
Unit testing (Exploring the other side as a tester)Unit testing (Exploring the other side as a tester)
Unit testing (Exploring the other side as a tester)
Abhijeet Vaikar
 
End-end tests as first class citizens - SeleniumConf 2020
End-end tests as first class citizens - SeleniumConf 2020End-end tests as first class citizens - SeleniumConf 2020
End-end tests as first class citizens - SeleniumConf 2020
Abhijeet Vaikar
 
Breaking free from static abuse in test automation frameworks and using Sprin...
Breaking free from static abuse in test automation frameworks and using Sprin...Breaking free from static abuse in test automation frameworks and using Sprin...
Breaking free from static abuse in test automation frameworks and using Sprin...
Abhijeet Vaikar
 
Upgrading Mobile Tester's Weapons with Advanced Debugging
Upgrading Mobile Tester's Weapons with Advanced DebuggingUpgrading Mobile Tester's Weapons with Advanced Debugging
Upgrading Mobile Tester's Weapons with Advanced Debugging
Abhijeet Vaikar
 
Ad

Recently uploaded (20)

Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Lionel Briand
 
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
AxisTechnolabs
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025
kashifyounis067
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Maxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINKMaxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINK
younisnoman75
 
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Lionel Briand
 
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
AxisTechnolabs
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025
kashifyounis067
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Maxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINKMaxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINK
younisnoman75
 

Good practices for debugging Selenium and Appium tests

  • 1. 11th Meetup 18 July 2019 DBS, Singapore Good practices for debugging Selenium and Appium tests
  • 2. Abhijeet Vaikar Senior Software Engineer Test @ Carousell Co-organizer @ taqelah! Testing web and mobile apps since 7 years LinkedIn: https://www.linkedin.com/in/abhijeetvaikar/ Twitter: https://twitter.com/AbhijeetVaikar
  • 4. Testing is a process of Learning, Discovering, Exploring, Analysing a system.
  • 5. Automated testing, thus is also a process of Learning, Discovering, Exploring, Analysing a system where the system is: ● the AUT ● and your test code too!
  • 6. Typical iteration of an automated UI test Local Execution ● Running test locally ● Verifying it works fine ● Fix if it breaks Continuous Integration ● Run the test along with other tests on a CI server against an in-house device farm or a cloud provider ● Analyse test runs Test Authoring and Prototyping ● Acceptance Criteria ● Inspecting the UI ● Creating UI locators ● Writing the test code ● Adding assertions
  • 7. Pass Automated Test Fail What failed? Why it failed? Where it failed? When it failed? A tester’s reactions to each iteration Authoring Local Execution CI execution
  • 10. Sources of debugging your Selenium/Appium code ● UI Inspectors and browser dev tools for debugging locators ● REPL tools for trying out Selenium/Appium client commands ● Debuggers in your IDE ● Test execution logs ● Selenium/Appium server logs ● Javascript console logs in browser ● Logs produced by native mobile apps ● Network logs
  • 11. UI Inspectors and browser dev tools for debugging locators
  • 12. Appium Desktop for UI inspection
  • 13. What can you do with Appium desktop? ● Inspect the UI hierarchy interactively ● Design and try out locators with different strategies ● Swipe by coordinates ● Tap by coordinates ● Record actions and convert them to script in the language of your choice (Javascript, Java-JUnit, Ruby, Python, Robot framework) along with boiler plate code ● Copy the XML UI hierarchy source which you can then inspect ● (New) Actions tab to execute device and session based actions
  • 15. Android specific: UiAutomator Viewer iOS specific: XCode’s Accessibility inspector Want more?
  • 16. Chrome dev tools ● Ctrl + F and paste your locator to evaluate ● Hit $x(“//*your-xpath-here”) in the console to evaluate a xpath ● Hit $(“your-css-selector”) in the console to evaluate a css selector ● Cheat sheets are your best friends (preferably avoid browser plugins that generate xpath/css selectors for you): https://www.red-gate.com/simple-talk/development/dotnet-development/xpath-css-dom-and-selenium-the-r osetta-stone/
  • 17. REPL tools for debugging Selenium/Appium client commands
  • 18. JShell - The REPL for Java (Since Java 9) https://www.linkedin.com/pulse/test-automation-selenium-webdriver-java-cli-via-jshell-nir-tal/
  • 19. You can also use the evaluate expression feature in IDEs like Eclipse/IntelliJ
  • 20. WebDriverIO REPL (Javascript) - for both Selenium and Appium https://webdriver.io/docs/repl.html
  • 21. from selenium import webdriver browser = webdriver.Firefox() browser.get('http://seleniumhq.org/' ) Python shell - REPL for Python Python being an interpreter, you can run each line of code separately in Python shell https://pypi.org/project/selenium/
  • 22. Ruby Build your own REPL for Selenium/Appium: http://elementalselenium.com/tips/11-build-an-interactive-prompt ARC (Appium Ruby Console): https://github.com/appium/ruby_console NodeJS Appium REPL: https://www.npmjs.com/package/appium-repl
  • 24. What do you prefer?
  • 25. System.out.println("I'm here"); System.out.println("Inside the function"); System.out.println("Outside the loop"); Imagine debugging across multiple classes by adding print statements!
  • 26. How to use a debugger - 101 1. Add a breakpoint against the line of code you want to start debugging from 2. Execute your test runner in Debug mode
  • 27. SAGE MODE ACTIVATED ● Step Over ● Step Into ● Force Step Into ● Step Out ● Evaluate Expression ● Resume normal execution ● Inspect all variables/objects https://naruto.fandom.com/wiki/Sage_Mode
  • 29. Use Logging libraries instead of: ● System.out.println() - Java ● Console.log() - Javascript/NodeJS ● print() - Python ● Puts - Ruby Test execution logs as a source for debugging test runs: ● Useful to understand what happened in your test ● Logs can be used for generating test reports
  • 30. Why use a logging framework for your tests? ● Customized output - Easy formatting ● Logging levels (INFO, WARN, ERROR, DEBUG, TRACE) ● Can easily switch it on or off based on requirement ● Ability to persist log output on various storage mechanisms (file, database) ● System.out.println() is an I/O operation
  • 31. Examples LOG.info("Initialising WebDriver on cloud provider: {}" , configuration. getCloudProvider ().toUpperCase()); LOG.info("TEST PASSED"); catch (WebDriverException e) { LOG.error("Error creating web driver" , e); System.exit(1); } LOG.warn("API call failed. Retrying again" ); LOG.warn("Unable to write the report json file : {}" , e); Info - Logging important information Error - Something went very wrong Warn - Unstable but can be recovered LOG.debug("Dismissing alert {}" , alert) Debug - Information only meant for debugging purpose
  • 33. Selenium WebDriver logs System.setProperty("webdriver.chrome.logfile" , "D:chromedriver.log" ); System.setProperty("webdriver.chrome.verboseLogging" , "true"); System.setProperty(FirefoxDriver. SystemProperty .DRIVER_USE_MARIONETTE ,"true"); System.setProperty(FirefoxDriver. SystemProperty .BROWSER_LOGFILE ,"C:templogs.t xt");
  • 34. Appium server logs --log /path/to/appium.log Server argument (When you start appium server) LogEntries logEntries = driver.manage().logs().get("server”); Programmatically
  • 36. How to keep Chrome dev tools open while you are debugging your Selenium test locally ChromeOptions options = new ChromeOptions(); options.addArguments("--disable-extensions" ); options.addArguments("--auto-open-devtools-for-tabs" ); driver = new ChromeDriver(options); How to fetch browser console logs (including errors) programmtically LogEntries logEntries = driver.manage().logs().get(LogType.BROWSER);
  • 37. Logs produced by native mobile apps
  • 38. Fetching ADB logs for Android device for debugging List<LogEntry> logEntries = driver.manage().logs().get("logcat").getAll(); Fetching iOS device logs ● idevicesyslog tool from the command line for real iOS Device ● Console app on MacOS to read console log from simulator
  • 40. MITMProxy - free and open source HTTPS proxy MITMProxy Java - A java wrapper for MITM Proxy Fiddler for Windows and MacOS
  • 41. What techniques or practices do you follow to debug your automation scripts? Please share!