cross platform browser automation tests sdp
TRANSCRIPT
![Page 1: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/1.jpg)
Copyright © SELA Software & Education Labs, Ltd. | 14-18 Baruch Hirsch St., Bnei Brak 51202, Israel | www.selagroup.com
Cross Browser Platform in Automation
Testing
Oren Ashkenazy
Mail: [email protected]
Blog: http://blogs.microsoft.co.il/oren604/
![Page 2: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/2.jpg)
Cross Platform Browser Testing
Intro to Selenium
Selenium Architecture
Selenium IDE
Selenium WebDriver
JavaScriptExecuter
WebDriverJS
Selenium Server
Agenda
![Page 3: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/3.jpg)
Cross platform Browser Testing
Advantages…
• Greater Test Coverage
• Increased Reusability
• Business advantage
• Secure Deployment To Production
![Page 4: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/4.jpg)
Test Plan
![Page 5: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/5.jpg)
Multiple Test Plan Capacity Work
𝐗 𝐧𝐮𝐦𝐛𝐞𝐫 𝐨𝐟 𝐜𝐨𝐧𝐟𝐢𝐠𝐮𝐫𝐚𝐫𝐢𝐨𝐧𝐬=
![Page 6: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/6.jpg)
…
![Page 7: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/7.jpg)
The Solution…
![Page 8: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/8.jpg)
Selenium Architecture
Code Behind
Browser Drivers
C# Java Ruby Python 2
WebDriver API
IE Firefox Chrome Safari
![Page 9: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/9.jpg)
Demo
Selenium IDE – Record & Running A
Test
![Page 10: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/10.jpg)
Demo
VS & Selenium Webdriver
![Page 11: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/11.jpg)
IWebDriver Basic Methods
Actions
Clear();
Click();
FindElement(string);
Array/List FindElements(string,string…);
SendKeys(string);
Submit();
Explore
GetAttribute(); (Id, ClassName, etc)
GetCSSValue(); (font-size, color, etc)
Enable;
Selected();
Size();
Text;
![Page 12: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/12.jpg)
IJavaScriptExecuter
![Page 13: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/13.jpg)
Demo
Execute JS with Selenium WebDriver
![Page 14: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/14.jpg)
Execute JS with Selenium WebDriver
Get the running browser agent/webdriver type
IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
String BrowserAgent = (String)((IJavaScriptExecutor)driver).ExecuteScript("return navigator.userAgent;");
![Page 15: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/15.jpg)
Execute JS with Selenium WebDriver
Pass browserAgent to the test method
public void FillAcountHolderData(IWebDriver driver, User user, string BrowserAgent)
{
if (BrowserAgent.Contains(“FireFox”)
} { // todo….
}
if (BrowserAgent.Contains(“Chrome”)
{ // todo….
}
}
![Page 16: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/16.jpg)
Cross Platform Testing
Reference for automation browser platforms:
https://code.google.com/p/selenium/w/list?q=label:WebDriver
![Page 17: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/17.jpg)
WebDriverJS
+ =
![Page 18: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/18.jpg)
The difference between WebDriver to
WebDriverJS
Sync
Asynchronous
C# Java Ruby
JavaScript
![Page 19: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/19.jpg)
Demo
WebDriverJS
![Page 20: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/20.jpg)
Open source web testing frameworks
![Page 21: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/21.jpg)
Selenium Server - Agenda
What Is Selenium Server?
What Is Selenium Grid?
Setting the hub (Server)
Setting the node (Client)
Using DesiredCapabilities
![Page 22: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/22.jpg)
What Is Selenium Server?
Selenium Code
Remote Control
Selenium Sever
IEFi
refo
xC
hro
me
Safa
ri
Dri
vers
![Page 23: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/23.jpg)
What Is Selenium Grid?
Selenium Code
Remote Control
Hub
Selenium Sever (Win 7 + Chrome)
Selenium Sever (Win 8 + IE)
Selenium Sever (Centos +
Firefox)
Ch
rom
e
Dri
ver
IE D
rive
rFi
refo
x D
rive
r
![Page 24: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/24.jpg)
Demo
Setting the Hub
![Page 25: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/25.jpg)
Install & Configure
• What to Install?o JRE (Java Runtime Environment)o Selenium Server (JAR File)
• How To Configure The Hub?o Run CMD o Go to the path you downloaded the Jar file: CD “Path Name”o Type the command: java -jar “jar file name” -role hub
o After running this command you will receive an output of the selenium server address (The default address is http://127.0.0.1:4444
o Leave CMD window open while you want the selenium server process to keep running
![Page 26: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/26.jpg)
Demo
Setting up a server node
![Page 27: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/27.jpg)
Setting up a server node
• How to configure?
o Run CMD
o Go to the path you downloaded the Jar file: CD “Path Name”
o Type the command: java -jar “Jar File Name” -role node -hub http://localhost:4444/grid/register
o Validate the node server is up by going to:
http://localhost:4444/grid/console
![Page 28: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/28.jpg)
Demo
Running a Test
![Page 29: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/29.jpg)
Use the RemoteWebDriver and the DesiredCapabilities object to define which browser, version and platform you wish to use
private IWebDriver driver = new RemoteWebDriver (new Uri("http://localhost:4444/wd/hub"),
DesiredCapabilities.Firefox());
Running a test using the grid
![Page 30: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/30.jpg)
In this example the test will run on machine/s that have IOS and Firefox driver
private IWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"),
new DesiredCapabilities("Firefox", "", new Platform(PlatformType.Mac)));
Using a specific configuration
![Page 31: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/31.jpg)
Selenium Grid Wiki
More information:
https://code.google.com/p/selenium/wiki/Grid2
![Page 32: Cross platform browser automation tests sdp](https://reader031.vdocuments.net/reader031/viewer/2022020116/55a690b51a28abb4418b460f/html5/thumbnails/32.jpg)
Questions