SlideShare a Scribd company logo
1
Wix Automation
Core
Roi Ashkenazi
Oded Gefen
2
Introduction
3
Introduction
Wix Editor
4
Modeling DOM Elements
5
Modeling DOM Elements
Concept
• Each editor component will have its own class (driver)
• Driver represents a DOM node and its sub DOM nodes
• ClassAPI will consist of methods returning sub drivers of the
component (building blocks)
• Methods can return other complex drivers or simple web
elements
6
Finding Elements
7
Finding Elements
Wix Editor
8
Finding Elements - Selenium
Wix Editor – Top Bar
public TopBar topBar() {
return getElement().byClass("top-bar-editor", TopBar.class);
}
9
Finding Elements - Selenium
TopBar.java - Driver
public Button preview() {
return getElement().byId("top-bar-preview", Button.class);
}
public Button undo() {
return getElement().byAttribute("automationId", "top-bar-undo",Button.class);
}
10
Finding Elements - JavaScript
• Re-written completely using React.js
• DOM nodes are less “rich” with information
• Need stable selectors to find elements
Wix Editor – Revisited
11
Finding Elements - JavaScript
Top Bar – React DOM
12
Finding Elements - JavaScript
TopBar.java - Driver
public PageNavButton pageNavigation() {
return getElement().byDisplayName("topBarPageNavButton", PageNavButton.class);
}
13
Finding Elements - Core
14
By - CSS
Concept
• Predefined methods for getting elements with different CSS
selectors
• Building the CSS selectors behind the scenes (transparent for
test code)
15
By - CSS
Standard examples
• byId (#)
• byClass (.)
• byAttribute ([attribute=‘value’])
• byCss(…)
Actual implementation
webDriver.findElement(By.cssSelector(selector));
16
By - DisplayName
Concept
• Find elements using “decorations” visible only in React DOM
• Use ReactTest Utilities (JavaScript)
public TopBar topBar() {
return getElement().byDisplayName("topBar", TopBar.class);
}
17
By - DisplayName
Actual implementation
Executing script located in client project:
- Pass display name string as script argument
- Script returns a corresponding list of seleniumWebElements
- Usage of findAllInRenderedTree method from ReactTest Utilities inside script
implementation
domSelectors.getElementsByDisplayName(arguments[0]);
18
By - DisplayName
Actual implementation
Stream<WebElementProxy> searchElements(WebElementProxy root) {
List elements = (List) executeScript(...);
return Stream.of(elements.toArray())
.filter(Objects::nonNull)
.map(WebElement.class::cast)
.map(WebElementProxy::new);
}
WebElementProxy searchElement(WebElementProxy root) {
return searchElements(root)
.findFirst()
.orElseThrow(() ->
new RuntimeException("Failed to get element " + this));
}
19
Wrapping Native Selenium
20
Wrapping Native Selenium
Concept
Wrapping useful selenium commands in our infrastructure
• Allows to change behavior of basic commands (e.g. wait after
click)
• Combine several actions together and create new actions (drag
and drop)
• Add smart waits instead of sleep
21
Wrapping WebDriver
API
• Navigation
 Open URL in new window
 Close extra tabs
 Switch focus to last window
 Wait for number of windows to be (etc..)
• Logs
 Network
 Console errors
• Cookies
 Add
 Find
 Remove
22
Wrapping WebDriver
API
• Navigation
 Open URL in new window
 Close extra tabs
 Switch focus to last window
 Wait for number of windows to be (etc..)
• Logs
 Network
 Console errors
• Cookies
 Add
 Find
 Remove
23
Wrapping WebDriver
API – Navigation – Open URL in new window
public void openUrlInNewWindow(String url) {
webDriver.executeScript("window.open()");
Object[] windowHandles = webDriver.getWindowHandles().toArray();
int numberOfWindows = windowHandles.size();
String targetWindowHandle = (String) windowHandles[numberOfWindows - 1];
webDriver.switchTo().window(targetWindowHandle);
webDriver.manage().window().maximize();
webDriver.get(url);
}
24
Wrapping WebElement
API
• Actions
• Attributes
• ElementWaitFor
25
Wrapping WebElement
API
• Actions
• Attributes
• ElementWaitFor
26
Wrapping WebElement
API – Actions
• dragAndDrop
• clickAtOffset
• doubleClick
• mouseMoveToElement
• setText
• rightClick
27
Wrapping WebElement
API – Actions
• dragAndDrop
• clickAtOffset
• doubleClick
• mouseMoveToElement
• setText
• rightClick
28
Wrapping WebElement
API – Actions – Drag and drop
public void dragAndDrop(int xOffset, int yOffset) {
Actions actions = new Actions(webDriver);
actions.clickAndHold(webElement)
.moveByOffset(xOffset, yOffset)
.release()
.perform();
}
29
Wrapping WebElement
API
• Actions
• Attributes
• ElementWaitFor
30
Wrapping WebElement
API – Attributes
• getInnerHTML
• getId
• getCssClasses
• getSize
• getText
• getPosition
• isVisible
• isEnabled
31
Wrapping WebElement
API – Attributes
• getInnerHTML
• getId
• getCssClasses
• getSize
• getText
• getPosition
• isVisible
• isEnabled
32
Wrapping WebElement
API – Attributes – Get inner HTML
public String getInnerHTML() {
String script = "return arguments[0].innerHTML;";
return (String) webDriver.executeScript(script, webElement);
}
33
Wrapping WebElement
API
• Actions
• Attributes
• ElementWaitFor
34
Wrapping WebElement
API – ElementWaitFor
• attributeToBe
• toExist
• toBeDisplayed
• textToBe
• toContainsCssClass
35
Wrapping WebElement
API – ElementWaitFor
• attributeToBe
• toExist
• toBeDisplayed
• textToBe
• toContainsCssClass
36
Wrapping WebElement
API – ElementWaitFor – Wait for attribute to be
public void attributeToBe(String attribute, String value) {
BusyWait.create(TIMEOUT,
POLLING_INTERVAL,
__ -> webElement.getAttribute(attribute).equals(value))
.execute();
}
37
Wrapping WebElement
API – ElementWaitFor – Wait for attribute to be
public void attributeToBe(String attribute, String value) {
BusyWait.create(TIMEOUT,
POLLING_INTERVAL,
__ -> webElement.getAttribute(attribute).equals(value))
.execute();
}
topBar.waitFor().attributeToBe(”state”, ”noErrors”);
38
39
Iframes
Concept
• Each element “knows” if it’s inside an iframe
• Each driver “knows” if it contains an iframe
• Getting an element inside the iframe is done differently
40
Iframes
@Iframe
class CKEditor extends Input {
public TextContainer textContainer() {
return getIframeElement().byCss("h1", TextContainer.class);
}
public Button bold() {
return getElement().byId(”boldBtn", Button.class);
}
}
41

More Related Content

What's hot

Services in cf
Services in cfServices in cf
Services in cf
dotchev
 
Grails transactions
Grails   transactionsGrails   transactions
Grails transactions
Husain Dalal
 
jQuery and AJAX with Rails
jQuery and AJAX with RailsjQuery and AJAX with Rails
jQuery and AJAX with Rails
Alan Hecht
 
Parse London Meetup - Cloud Code Tips & Tricks
Parse London Meetup - Cloud Code Tips & TricksParse London Meetup - Cloud Code Tips & Tricks
Parse London Meetup - Cloud Code Tips & Tricks
Hector Ramos
 
Intro to ReactJS
Intro to ReactJSIntro to ReactJS
Intro to ReactJS
Harvard Web Working Group
 
jQuery and Rails: Best Friends Forever
jQuery and Rails: Best Friends ForeverjQuery and Rails: Best Friends Forever
jQuery and Rails: Best Friends Forever
stephskardal
 
Angular2 and TypeScript
Angular2 and TypeScriptAngular2 and TypeScript
Angular2 and TypeScript
David Giard
 
Google App Engine Developer - Day2
Google App Engine Developer - Day2Google App Engine Developer - Day2
Google App Engine Developer - Day2
Simon Su
 
Mock objects in PHPUnit
Mock objects in PHPUnitMock objects in PHPUnit
Mock objects in PHPUnit
Rinat Khabibiev
 
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
Dan Wahlin
 
Web Components: The future of Web Application Development
Web Components: The future of Web Application DevelopmentWeb Components: The future of Web Application Development
Web Components: The future of Web Application Development
Jermaine Oppong
 
React state management with Redux and MobX
React state management with Redux and MobXReact state management with Redux and MobX
React state management with Redux and MobX
Darko Kukovec
 
React js
React jsReact js
ASP.NET MVC Internals
ASP.NET MVC InternalsASP.NET MVC Internals
ASP.NET MVC Internals
Vitaly Baum
 
Utilising the data attribute
Utilising the data attributeUtilising the data attribute
Utilising the data attribute
Richard Martens
 
jQuery On Rails
jQuery On RailsjQuery On Rails
jQuery On Rails
Jonathan Sharp
 
Using redux
Using reduxUsing redux
Using redux
Jonas Ohlsson Aden
 
Vue js and Dyploma
Vue js and DyplomaVue js and Dyploma
Vue js and Dyploma
Yoram Kornatzky
 
E script-Examples
E script-ExamplesE script-Examples
E script-Examples
maitvam
 
React + Redux for Web Developers
React + Redux for Web DevelopersReact + Redux for Web Developers
React + Redux for Web Developers
Jamal Sinclair O'Garro
 

What's hot (20)

Services in cf
Services in cfServices in cf
Services in cf
 
Grails transactions
Grails   transactionsGrails   transactions
Grails transactions
 
jQuery and AJAX with Rails
jQuery and AJAX with RailsjQuery and AJAX with Rails
jQuery and AJAX with Rails
 
Parse London Meetup - Cloud Code Tips & Tricks
Parse London Meetup - Cloud Code Tips & TricksParse London Meetup - Cloud Code Tips & Tricks
Parse London Meetup - Cloud Code Tips & Tricks
 
Intro to ReactJS
Intro to ReactJSIntro to ReactJS
Intro to ReactJS
 
jQuery and Rails: Best Friends Forever
jQuery and Rails: Best Friends ForeverjQuery and Rails: Best Friends Forever
jQuery and Rails: Best Friends Forever
 
Angular2 and TypeScript
Angular2 and TypeScriptAngular2 and TypeScript
Angular2 and TypeScript
 
Google App Engine Developer - Day2
Google App Engine Developer - Day2Google App Engine Developer - Day2
Google App Engine Developer - Day2
 
Mock objects in PHPUnit
Mock objects in PHPUnitMock objects in PHPUnit
Mock objects in PHPUnit
 
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
 
Web Components: The future of Web Application Development
Web Components: The future of Web Application DevelopmentWeb Components: The future of Web Application Development
Web Components: The future of Web Application Development
 
React state management with Redux and MobX
React state management with Redux and MobXReact state management with Redux and MobX
React state management with Redux and MobX
 
React js
React jsReact js
React js
 
ASP.NET MVC Internals
ASP.NET MVC InternalsASP.NET MVC Internals
ASP.NET MVC Internals
 
Utilising the data attribute
Utilising the data attributeUtilising the data attribute
Utilising the data attribute
 
jQuery On Rails
jQuery On RailsjQuery On Rails
jQuery On Rails
 
Using redux
Using reduxUsing redux
Using redux
 
Vue js and Dyploma
Vue js and DyplomaVue js and Dyploma
Vue js and Dyploma
 
E script-Examples
E script-ExamplesE script-Examples
E script-Examples
 
React + Redux for Web Developers
React + Redux for Web DevelopersReact + Redux for Web Developers
React + Redux for Web Developers
 

Viewers also liked

Wix Automation Infrastructure
Wix Automation Infrastructure Wix Automation Infrastructure
Wix Automation Infrastructure
Efrat Attas
 
Wix Automation - The False Positive Paradox
Wix Automation - The False Positive ParadoxWix Automation - The False Positive Paradox
Wix Automation - The False Positive Paradox
Efrat Attas
 
Wix Automation - It's That Easy!
Wix Automation - It's That Easy!Wix Automation - It's That Easy!
Wix Automation - It's That Easy!
Efrat Attas
 
Wix Automation - Automation Manager
Wix Automation - Automation ManagerWix Automation - Automation Manager
Wix Automation - Automation Manager
Efrat Attas
 
Wix automation
Wix automationWix automation
Wix automation
itay shmool
 
MyHeritage - QA Automations in a Continuous Deployment environment
MyHeritage -  QA Automations in a Continuous Deployment environmentMyHeritage -  QA Automations in a Continuous Deployment environment
MyHeritage - QA Automations in a Continuous Deployment environment
MatanGoren
 
Continuous Deployment Applied at MyHeritage
Continuous Deployment Applied at MyHeritageContinuous Deployment Applied at MyHeritage
Continuous Deployment Applied at MyHeritage
Ran Levy
 

Viewers also liked (7)

Wix Automation Infrastructure
Wix Automation Infrastructure Wix Automation Infrastructure
Wix Automation Infrastructure
 
Wix Automation - The False Positive Paradox
Wix Automation - The False Positive ParadoxWix Automation - The False Positive Paradox
Wix Automation - The False Positive Paradox
 
Wix Automation - It's That Easy!
Wix Automation - It's That Easy!Wix Automation - It's That Easy!
Wix Automation - It's That Easy!
 
Wix Automation - Automation Manager
Wix Automation - Automation ManagerWix Automation - Automation Manager
Wix Automation - Automation Manager
 
Wix automation
Wix automationWix automation
Wix automation
 
MyHeritage - QA Automations in a Continuous Deployment environment
MyHeritage -  QA Automations in a Continuous Deployment environmentMyHeritage -  QA Automations in a Continuous Deployment environment
MyHeritage - QA Automations in a Continuous Deployment environment
 
Continuous Deployment Applied at MyHeritage
Continuous Deployment Applied at MyHeritageContinuous Deployment Applied at MyHeritage
Continuous Deployment Applied at MyHeritage
 

Similar to Wix Automation - Core

Breaking the limits_of_page_objects
Breaking the limits_of_page_objectsBreaking the limits_of_page_objects
Breaking the limits_of_page_objects
Robert Bossek
 
Writing HTML5 Web Apps using Backbone.js and GAE
Writing HTML5 Web Apps using Backbone.js and GAEWriting HTML5 Web Apps using Backbone.js and GAE
Writing HTML5 Web Apps using Backbone.js and GAE
Ron Reiter
 
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
SPTechCon
 
Introduction to selenium web driver
Introduction to selenium web driverIntroduction to selenium web driver
Introduction to selenium web driver
Return on Intelligence
 
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD CombinationLotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Sean Burgess
 
Introduction to Selenium Web Driver
Introduction to Selenium Web DriverIntroduction to Selenium Web Driver
Introduction to Selenium Web Driver
Return on Intelligence
 
jQuery Fundamentals
jQuery FundamentalsjQuery Fundamentals
jQuery Fundamentals
Gil Fink
 
Escape from the automation hell
Escape from the automation hellEscape from the automation hell
Escape from the automation hell
Nikita Simonovets
 
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Roy de Kleijn
 
ASP.NET Core 1.0
ASP.NET Core 1.0ASP.NET Core 1.0
ASP.NET Core 1.0
Ido Flatow
 
Quick Fetch API Introduction
Quick Fetch API IntroductionQuick Fetch API Introduction
Quick Fetch API Introduction
Chris Love
 
Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications  Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications
Juliana Lucena
 
Building Universal Web Apps with React ForwardJS 2017
Building Universal Web Apps with React ForwardJS 2017Building Universal Web Apps with React ForwardJS 2017
Building Universal Web Apps with React ForwardJS 2017
Elyse Kolker Gordon
 
Selenium withnet
Selenium withnetSelenium withnet
Selenium withnet
Vlad Maniak
 
Web driver training
Web driver trainingWeb driver training
Web driver training
Dipesh Bhatewara
 
React js
React jsReact js
React js
Rajesh Kolla
 
Automated Testing ADF with Selenium
Automated Testing ADF with SeleniumAutomated Testing ADF with Selenium
Automated Testing ADF with Selenium
Wilfred van der Deijl
 
Component Based Unit Testing ADF with Selenium
Component Based Unit Testing ADF with SeleniumComponent Based Unit Testing ADF with Selenium
Component Based Unit Testing ADF with Selenium
Richard Olrichs
 
Iniciando com jquery
Iniciando com jqueryIniciando com jquery
Iniciando com jquery
Danilo Sousa
 
react-slides.pdf
react-slides.pdfreact-slides.pdf
react-slides.pdf
DayNightGaMiNg
 

Similar to Wix Automation - Core (20)

Breaking the limits_of_page_objects
Breaking the limits_of_page_objectsBreaking the limits_of_page_objects
Breaking the limits_of_page_objects
 
Writing HTML5 Web Apps using Backbone.js and GAE
Writing HTML5 Web Apps using Backbone.js and GAEWriting HTML5 Web Apps using Backbone.js and GAE
Writing HTML5 Web Apps using Backbone.js and GAE
 
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
 
Introduction to selenium web driver
Introduction to selenium web driverIntroduction to selenium web driver
Introduction to selenium web driver
 
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD CombinationLotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
 
Introduction to Selenium Web Driver
Introduction to Selenium Web DriverIntroduction to Selenium Web Driver
Introduction to Selenium Web Driver
 
jQuery Fundamentals
jQuery FundamentalsjQuery Fundamentals
jQuery Fundamentals
 
Escape from the automation hell
Escape from the automation hellEscape from the automation hell
Escape from the automation hell
 
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
 
ASP.NET Core 1.0
ASP.NET Core 1.0ASP.NET Core 1.0
ASP.NET Core 1.0
 
Quick Fetch API Introduction
Quick Fetch API IntroductionQuick Fetch API Introduction
Quick Fetch API Introduction
 
Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications  Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications
 
Building Universal Web Apps with React ForwardJS 2017
Building Universal Web Apps with React ForwardJS 2017Building Universal Web Apps with React ForwardJS 2017
Building Universal Web Apps with React ForwardJS 2017
 
Selenium withnet
Selenium withnetSelenium withnet
Selenium withnet
 
Web driver training
Web driver trainingWeb driver training
Web driver training
 
React js
React jsReact js
React js
 
Automated Testing ADF with Selenium
Automated Testing ADF with SeleniumAutomated Testing ADF with Selenium
Automated Testing ADF with Selenium
 
Component Based Unit Testing ADF with Selenium
Component Based Unit Testing ADF with SeleniumComponent Based Unit Testing ADF with Selenium
Component Based Unit Testing ADF with Selenium
 
Iniciando com jquery
Iniciando com jqueryIniciando com jquery
Iniciando com jquery
 
react-slides.pdf
react-slides.pdfreact-slides.pdf
react-slides.pdf
 

Recently uploaded

zOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL DifferenceszOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL Differences
YousufSait3
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
Peter Muessig
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
Hornet Dynamics
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
ICS
 
SQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure MalaysiaSQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure Malaysia
GohKiangHock
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
Sven Peters
 
Lecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptxLecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptx
TaghreedAltamimi
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
Remote DBA Services
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
Green Software Development
 
YAML crash COURSE how to write yaml file for adding configuring details
YAML crash COURSE how to write yaml file for adding configuring detailsYAML crash COURSE how to write yaml file for adding configuring details
YAML crash COURSE how to write yaml file for adding configuring details
NishanthaBulumulla1
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
Quickdice ERP
 
14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
ShulagnaSarkar2
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
Alina Yurenko
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Julian Hyde
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
VALiNTRY360
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 

Recently uploaded (20)

zOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL DifferenceszOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL Differences
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
 
SQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure MalaysiaSQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure Malaysia
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
 
Lecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptxLecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptx
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
 
YAML crash COURSE how to write yaml file for adding configuring details
YAML crash COURSE how to write yaml file for adding configuring detailsYAML crash COURSE how to write yaml file for adding configuring details
YAML crash COURSE how to write yaml file for adding configuring details
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
 
14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 

Wix Automation - Core

  • 5. 5 Modeling DOM Elements Concept • Each editor component will have its own class (driver) • Driver represents a DOM node and its sub DOM nodes • ClassAPI will consist of methods returning sub drivers of the component (building blocks) • Methods can return other complex drivers or simple web elements
  • 8. 8 Finding Elements - Selenium Wix Editor – Top Bar public TopBar topBar() { return getElement().byClass("top-bar-editor", TopBar.class); }
  • 9. 9 Finding Elements - Selenium TopBar.java - Driver public Button preview() { return getElement().byId("top-bar-preview", Button.class); } public Button undo() { return getElement().byAttribute("automationId", "top-bar-undo",Button.class); }
  • 10. 10 Finding Elements - JavaScript • Re-written completely using React.js • DOM nodes are less “rich” with information • Need stable selectors to find elements Wix Editor – Revisited
  • 11. 11 Finding Elements - JavaScript Top Bar – React DOM
  • 12. 12 Finding Elements - JavaScript TopBar.java - Driver public PageNavButton pageNavigation() { return getElement().byDisplayName("topBarPageNavButton", PageNavButton.class); }
  • 14. 14 By - CSS Concept • Predefined methods for getting elements with different CSS selectors • Building the CSS selectors behind the scenes (transparent for test code)
  • 15. 15 By - CSS Standard examples • byId (#) • byClass (.) • byAttribute ([attribute=‘value’]) • byCss(…) Actual implementation webDriver.findElement(By.cssSelector(selector));
  • 16. 16 By - DisplayName Concept • Find elements using “decorations” visible only in React DOM • Use ReactTest Utilities (JavaScript) public TopBar topBar() { return getElement().byDisplayName("topBar", TopBar.class); }
  • 17. 17 By - DisplayName Actual implementation Executing script located in client project: - Pass display name string as script argument - Script returns a corresponding list of seleniumWebElements - Usage of findAllInRenderedTree method from ReactTest Utilities inside script implementation domSelectors.getElementsByDisplayName(arguments[0]);
  • 18. 18 By - DisplayName Actual implementation Stream<WebElementProxy> searchElements(WebElementProxy root) { List elements = (List) executeScript(...); return Stream.of(elements.toArray()) .filter(Objects::nonNull) .map(WebElement.class::cast) .map(WebElementProxy::new); } WebElementProxy searchElement(WebElementProxy root) { return searchElements(root) .findFirst() .orElseThrow(() -> new RuntimeException("Failed to get element " + this)); }
  • 20. 20 Wrapping Native Selenium Concept Wrapping useful selenium commands in our infrastructure • Allows to change behavior of basic commands (e.g. wait after click) • Combine several actions together and create new actions (drag and drop) • Add smart waits instead of sleep
  • 21. 21 Wrapping WebDriver API • Navigation  Open URL in new window  Close extra tabs  Switch focus to last window  Wait for number of windows to be (etc..) • Logs  Network  Console errors • Cookies  Add  Find  Remove
  • 22. 22 Wrapping WebDriver API • Navigation  Open URL in new window  Close extra tabs  Switch focus to last window  Wait for number of windows to be (etc..) • Logs  Network  Console errors • Cookies  Add  Find  Remove
  • 23. 23 Wrapping WebDriver API – Navigation – Open URL in new window public void openUrlInNewWindow(String url) { webDriver.executeScript("window.open()"); Object[] windowHandles = webDriver.getWindowHandles().toArray(); int numberOfWindows = windowHandles.size(); String targetWindowHandle = (String) windowHandles[numberOfWindows - 1]; webDriver.switchTo().window(targetWindowHandle); webDriver.manage().window().maximize(); webDriver.get(url); }
  • 24. 24 Wrapping WebElement API • Actions • Attributes • ElementWaitFor
  • 25. 25 Wrapping WebElement API • Actions • Attributes • ElementWaitFor
  • 26. 26 Wrapping WebElement API – Actions • dragAndDrop • clickAtOffset • doubleClick • mouseMoveToElement • setText • rightClick
  • 27. 27 Wrapping WebElement API – Actions • dragAndDrop • clickAtOffset • doubleClick • mouseMoveToElement • setText • rightClick
  • 28. 28 Wrapping WebElement API – Actions – Drag and drop public void dragAndDrop(int xOffset, int yOffset) { Actions actions = new Actions(webDriver); actions.clickAndHold(webElement) .moveByOffset(xOffset, yOffset) .release() .perform(); }
  • 29. 29 Wrapping WebElement API • Actions • Attributes • ElementWaitFor
  • 30. 30 Wrapping WebElement API – Attributes • getInnerHTML • getId • getCssClasses • getSize • getText • getPosition • isVisible • isEnabled
  • 31. 31 Wrapping WebElement API – Attributes • getInnerHTML • getId • getCssClasses • getSize • getText • getPosition • isVisible • isEnabled
  • 32. 32 Wrapping WebElement API – Attributes – Get inner HTML public String getInnerHTML() { String script = "return arguments[0].innerHTML;"; return (String) webDriver.executeScript(script, webElement); }
  • 33. 33 Wrapping WebElement API • Actions • Attributes • ElementWaitFor
  • 34. 34 Wrapping WebElement API – ElementWaitFor • attributeToBe • toExist • toBeDisplayed • textToBe • toContainsCssClass
  • 35. 35 Wrapping WebElement API – ElementWaitFor • attributeToBe • toExist • toBeDisplayed • textToBe • toContainsCssClass
  • 36. 36 Wrapping WebElement API – ElementWaitFor – Wait for attribute to be public void attributeToBe(String attribute, String value) { BusyWait.create(TIMEOUT, POLLING_INTERVAL, __ -> webElement.getAttribute(attribute).equals(value)) .execute(); }
  • 37. 37 Wrapping WebElement API – ElementWaitFor – Wait for attribute to be public void attributeToBe(String attribute, String value) { BusyWait.create(TIMEOUT, POLLING_INTERVAL, __ -> webElement.getAttribute(attribute).equals(value)) .execute(); } topBar.waitFor().attributeToBe(”state”, ”noErrors”);
  • 38. 38
  • 39. 39 Iframes Concept • Each element “knows” if it’s inside an iframe • Each driver “knows” if it contains an iframe • Getting an element inside the iframe is done differently
  • 40. 40 Iframes @Iframe class CKEditor extends Input { public TextContainer textContainer() { return getIframeElement().byCss("h1", TextContainer.class); } public Button bold() { return getElement().byId(”boldBtn", Button.class); } }
  • 41. 41