by admin | Nov 5, 2021 | Mobile App Testing, Blog, Latest Post |
An application crash is a developer’s worst nightmare. Even though it happens to everyone, it could be unbearable for your users and may cost you financial damages. Recurring crashes lead to more uninstalls; therefore, it’s great that there are numerous techniques to avoid them during mobile app testing. To accomplish this, your program must consistently provide a good user experience.
To ensure the stability of your application, first, identify the primary sources of crashes and devise methods to avoid them. Here’s how you can prevent app crashes by testing your app’s stability:
Memory and Processing Management
Memory difficulties are a leading cause of software crashes because not all users own high-end tablets and smartphones. As a result, your software must perform its intended functions while maintaining memory management.
To proceed, take caution not to utilize too much RAM. When possible, make use of your cache. Determine which parts of your software consume the most data or have the most complex data structures, and make sure they are all required.
Additionally, you can also profile your program to find memory leaks. As you structure network inquiries to avoid overburdening the device, craft methods and strategies to save memory and prepare a list of what to keep and what to delete.
Error Surveillance
Once you’ve identified errors and problems, you can rectify them. And when it comes to fixing app breakdowns and issues, you must go above and beyond. One method is to monitor the performance of the Internet Information Server and look for flaws.
For example, if a user’s WiFi connection goes down during a file transfer, you can notify them via a communication channel. When failures occur as a result of unexpected app behavior, you’ll need crash detection tools in your mobile app testing kit.
App Compatibility Testing
To test your program or app, use as many platforms, devices, manufacturers, and generations as possible. You can use this method to determine your compatibility. The majority, if not all, of devices and platforms are supported.
You must, however, be mindful of your limitations. Comprehensive mobile app testing will ensure that your app is compatible with a wide range of devices and will aid you in finding and addressing flaws before its release.
Activate Offline Use
Continuous network connectivity issues can harm your application system and may lead to a bad reputation. Users may be dissatisfied if they need your program but cannot access it due to a lack of internet access.
By employing a local data store such as Google Room, you can create an app that functions flawlessly offline. The application’s offline mode can help you prevent crashes and freezes caused by a sluggish internet connection.
However, early testing of mobile apps on slow networks may reveal weaknesses, preventing software from becoming inoperable on all networks. So, make it a point to check if the program works on unreliable networks.
Conclusion
While not all accidents are avoidable, those that are can be corrected quickly. This notion applies to developing applications as well. To put it simply, one of the most effective ways to learn about and fix your crashes is to use crash reporting tools. As you gather data and further broaden your knowledge, you’ll be able to create an app that is efficient and useful to your users.
Are you looking for mobile app testing services? Codoid is a forerunner in quality assurance comprising a team that guides and leads the community. For your assurance, our brilliant engineers attend meetup groups, forums, software quality assurance events, and automated testing conferences on a regular basis. Get in touch with us today!
by admin | Nov 4, 2021 | Mobile App Testing, Blog, Latest Post |
Appium is a great choice if you are on the lookout for open source tools to automate mobile applications. Be it native, web, or hybrid applications, Appium will be able to automate it. In addition to that, it has cross-platform support across Android, iOS, and Windows as well. Last but not the least, its support for multiple programming languages like C#, Python, Java, Ruby, PHP, JavaScript with node.js, and so on. As a leading QA company, Appium has been always been our go-to tool in many of our projects. So in this Appium guide, we will be giving you a thorough walkthrough of how you can run tests on real devices using Appium. Let’s take a look at a few other advantages that Appium has to offer before we proceed further.
Advantages of Appium
- Appium is an open-source tool that is very easy to install. Reinstallation of the application is also not needed when there are any small changes that have to be made.
- Appium doesn’t require any application source code or library.
- It has an active and helpful community.
- Unlike other testing tools, you wouldn’t have to include any additional agents in your app for making it compatible with Appium for automation. It will test the same app that will be uploaded to the App or Play Store.
- Beyond testing the mobile apps from Android and iOS, it can also be used to test windows desktop applications.
- Parallel execution of test scripts can be achieved by using Appium.
Prerequisites for using Appium
Now in this Appium Guide, let’s take a look at few of the prerequisite you’ll be needing in order to get Appium up and running. You would have to install the following,
- Java (JDK)
- Android Studio
- Additional Android SDK tools
- Appium jar file
- Appium Desktop Client
- Eclipse IDE for Java
Note: Node.js and NPM will be there by default whenever the Appium server is installed. It is not required to install node.js and NPM separately as would be already included in the current version of Appium.
Appium Guide to install Appium with Node.js
Step 1: Check if node.js is installed on your system by entering the below-mentioned code in Command prompt. Step 1 isn’t the only step where we have mentioned the codes. So make sure to use the appropriate codes we have highlighted in the command prompt.
node --version
npm –version
Step 2: Download the node.js installer
Step 3: Run the installer & install node.js & npm
Step 4: Check if node.js & npm are installed.
node --version
npm --version
where node
where npm
Step 5: Install Appium with node.js
Step 6: Check if Appium has been installed
Step 7: Start Appium
Installing Appium with APPIUM DESKTOP CLIENT in Windows
Step 1: Download the Appium desktop client
http://appium.io/
https://github.com/appium/appium-desk
Step 2: Install the Appium desktop client
Step 3: Start Appium through the desktop client
Appium Guide to install Appium on MacOS
Step 1: Check if node is installed on your system
Step 2: Install node.js
https://nodejs.org/en/download/
https://brew.sh/
Step 3: Check if node is installed using these codes
Step 4: Install Appium
Step 5: Check if Appium is installed
Step 6: Use the below code to start appium
Installing Appium with Appium desktop client
Step 1: Download the Appium desktop client
http://appium.io/
https://github.com/appium/appium-desktop
Step 2: Double click on the .dmg file to install the Appium desktop client
Step 3: Start the Appium desktop client
To verify Appium’s installation and its dependencies
Install Appium-doctor as it is a tool used to verify Appium installation. We can install it by using npm as we’ve already installed node
npm install appium doctor -g
If you want to check the version of Appium doctor, use the following code
How to uninstall Appium
If you had installed through node.js, then use the below code,
If you had installed the Appium Desktop Client, then just delete the app
Appium Guide to connect a Real Android Mobile Device on Windows
Step 1: Download SDK tools
https://developer.android.com/studio
Step 2: Unzip the folder and then extract the platform-tools using the below code
sdkmanager “platform-tools” “platforms;android-28”
This command will extract the platform-tools
Step 3: Set the environment variables
ANDROID_HOME=location of SDK folder
Path: Append the path of the plaform_tools folder
Step 4: Check the command ‘adb devices’ in the command line
Step 5: Make the device ready
Enable developer mode to turn on ‘USB Debugging’
Step 6: Connect the real device to the computer using a USB cable.
Step 7: Run the below command
adb devices
adb = android debug bridge
Check if your device ID is displayed.
Appium Guide to Connect Real Android Device on macOS
To achieve this, you must have Java installed on your system, and the JAVA_HOME should be set in the environment variables command to check the Java –version. You should have also installed homebrew.
Step 1: Download the Android SDK
You can download it using this link directly and install it using the below-mentioned codes.
brew install android-sdk
brew cask install android-sdk
Step 2: Extract the platform-tools folder using the following command
sdkmanager “platform-tools” “platforms;android-28”
Step 3: Add environment variables
ANDROID_HOME = path of android-sdk folder
Path: Append the path of the platform-tools folder
export ANDROID_HOME=/usr/local/share/android-sdk
echo $ANDROID_HOME
export PATH="/usr/local/Caskroom/android-sdk/4333796/platform-tools:${PATH}"
Use the below code to set the environment variables permanently on the Mac system
If bash_profile does not exist
bash_profile
Press i and add the following
For setting the PATH for ANDROID_HOME
export ANDROID_HOME=/usr/local/share/android-sdk
For adding the platform tools to the PATH
PATH="/usr/local/Caskroom/android-sdk/4333796/platform-tools:${PATH}”
Press the ‘Esc’ key
Hit ‘Enter’
Now Android Home and Path have been set permanently.
echo $ANDROID_HOME
echo $PATH
You should be able to run the command ‘adb devices’ now.
Step 4: Same as Windows, make your mobile device ready for automation by enabling developer options and turning on the ‘USB Debugging’ option.
Step 5: Connect the real device with your computer system using a USB cable.
Step 6: Run the following command
Check if the Device ID is displayed
Running Your First Test on a Real Mobile Device
Step 1: Download Eclipse or any other IDE for Java
Step 2: Create a Java project
Step 3: Add the following libraries
1. Selenium Java
2. Appium Java client
https://mvnrepository.com/
Step 4: Connect your device and run the below command
Step 5: Start the Appium server either from the command line or using the Appium Desktop Client
Step 6: Add the code to start automation on your mobile device.
Set the desired capabilities and start the calculator application.
deviceName
udid
platformName
platformVersion
appPackage
appActivity
Step 7: Run and validate
Appium Test Case for Native Android App (Calculator)
Step 1: Download the ADT Eclipse plugin or download the ADT bundle separately
Step 2: Open Eclipse and Create a new Project >> Package >> Class
Step 3: Import the Selenium library and TestNG inside that new project.
Step 4: Now create a small test Program for ‘Calculator.app’ to add two numbers.
package src_Appium;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
//import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.*;
public class Calculator {
WebDriver driver;
@BeforeClass
public void setUp() throws MalformedURLException{
//Set up desired capabilities and pass the Android app-activity and app-package to Appium
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("BROWSER_NAME", "Android");
capabilities.setCapability("VERSION", "4.4.2");
capabilities.setCapability("deviceName","Emulator");
capabilities.setCapability("platformName","Android");
capabilities.setCapability("appPackage", "com.android.calculator2");
// This package name of your app (you can get it from apk info app)
capabilities.setCapability("appActivity","com.android.calculator2.Calculator"); // This is Launcher activity of your app (you can get it from apk info app)
//Create RemoteWebDriver instance and connect to the Appium server
//It will launch the Calculator App in Android Device using the configurations specified in Desired Capabilities
driver = new RemoteWebDriver(new URL("https://127.0.0.1:4723/wd/hub"), capabilities);
}
@Test
public void testCal() throws Exception {
//locate the Text on the calculator by using By.name()
WebElement two=driver.findElement(By.name("2"));
two.click();
WebElement plus=driver.findElement(By.name("+"));
plus.click();
WebElement four=driver.findElement(By.name("4"));
four.click();
WebElement equalTo=driver.findElement(By.name("="));
equalTo.click();
//locate the edit box of the calculator by using By.tagName()
WebElement results=driver.findElement(By.tagName("EditText"));
//Check the calculated value on the edit box
assert results.getText().equals("6"):"Actual value is : "+results.getText()+" did not match with expected value: 6";
}
@AfterClass
public void teardown(){
//close the app
driver.quit();
}
}
Conclusion
So we have done a comprehensive coverage of everything that you would need to know in this Appium Guide like the advantages of Appium, the methods to install Appium on both Windows and macOS, and also saw how to connect a real device on both platforms and run a test. We hope you’ve found this blog to be informative. As one of the best mobile app testing services providers, we highly recommend Appium for your testing projects to get the best results.
by admin | Nov 2, 2021 | Automation Testing, Blog, Latest Post |
Jenkins has risen to become an expert in Continuous Integration, Continuous Testing, & Continuous Delivery, and assumes a critical role in conveying great applications or items. It utilizes a component called the Jenkins pipeline for achieving Continuous Delivery (i.e.) the capacity to deliver applications routinely for a long stretch. This Jenkins pipeline guarantees that the product is consistently prepared for creation. As a leading QA Company, we have been using the Jenkins Pipeline and found it to be very effective. So if you are looking for a Jenkins Pipeline Tutorial that covers everything from the basics of the pipeline to learning how to perform parallel execution, you’ve found it.
What is a Jenkins Pipeline?
A pipeline in the Jenkins CI/CD can be defined as a series of events or even tasks that are interconnected to each other in a specific order. To put it in simpler terms, the Jenkins pipeline can also be characterized as a set of modules or plugins that enable the implementation & integration of the Continuous Delivery pipelines within Jenkins. It has an expandable automation system that can be used to build basic or complicated ‘template’ distribution pipelines via the Domain-specific language (DSL) used in the pipeline. Continuous Delivery in the Jenkins pipeline comprises 4 major states,
- Build
- Deploy
- Test
- Release
We will be taking a closer look at these states later on in the Jenkins Pipeline Tutorial, but first, let’s take a peek at the many advantages that the Jenkins pipeline CI/CD has to offer.
Advantages of the Pipeline:
- It can divide the jobs into parts (build /test /deploy) and each part can run in each agent.
- Parallel execution of stages is easy to configure and so it can be instrumental in saving time.
- Each stage can execute the different versions of JDK/MVN versions.
- It can be retriggered even from a failed stage.
- Visualizing the build flow becomes possible.
- The build can hold until the user gives the input.
- Version control and code reviews are made easier.
- We can pause and restart the build as and when we wish.
- It will automatically be created as sub-branches in a multi-branch pipeline script.
Pipeline’s Basic Keywords:
Knowing the basic keywords that will be used in the pipeline is the first step that we will be taking in our Jenkins Pipeline Tutorial. So let’s see what these keywords are and how you can use them in the pipeline. We’ll start with ‘Steps’.
Steps
- Steps have to be written inside the stage directive.
- Steps contains the command or scripts that we’ve used in the build.
-
- One step’s directive should be there in the stage directive.
Stage
- Stage defines a particular stage (build/test/deploy/..) of our job.
- There has to be a minimum of at least one stage.
- The name of the stage will be displayed on the Jenkins dashboard.
Stages
Stage and Stages are two different keywords that you shouldn’t confuse yourself with.
- It contains a sequence of the stages we saw earlier.
- There has to be at least one stage.
Agent
- It defines where we need to run our pipeline script. (Master/Slave/Container)
Stage color
So using color, we will be able to find out the current status of the stage.
- White – The stage hasn’t yet been executed.
- Green – The stage is a success.
- Blue Lines – The stage is being executed.
- Red Line or Red Lines – The stage has failed.
- Red (If in case few stages were a success and one failed, it will show red even if the few have been successful)
Types of Pipeline
1. Declarative pipeline
2. Scripted pipeline
So as seen above, there are two types of the pipeline, and the declarative pipeline is the recent addition that has the more simplified and opinionated syntax when compared to the scripted pipeline. Now let’s take a look at the syntax for these types.
Declarative Pipeline syntax:
Pipeline {
agent any
stages {
stage(‘Build’) {
Steps {
}
}
stage(‘Test’){
steps {
}
}
stage(‘Deploy’){
steps {
}
}
}
}
Scripted Pipeline Syntax:
node {
stage(‘Build’) {
}
stage(Test’) {
}
stage(‘Deploy’) {
}
}
Variables in the pipeline:
What is a variable?
A variable is used to store values. There are two types of variables, and they are predefined and user-defined variables.
<variable name> = <variable value>
Predefined Variable:
pipeline{
agent any
stages{
stage('pre'){
steps{
echo " predefined variable $BUILD_NUMBER $WORKSPACE "
}
}
}
}
Output:

User-defined Variable:
User-defined Variable we can define in root level or stage level
pipeline {
agent any
environment{
MYHOME="Chennai"
}
stages{
stage('User'){
steps{
echo " userdefined variable $MYHOME "
}
}
}
}
Output:

Parameters in Pipeline:
Parameters are used to pass the following types of data dynamically.
- String
- Text
- Boolean
- Choice
- Password
- File
Implementation of Parameters in Pipeline:
pipeline{
agent any
parameters {
string(name: 'DEPLOY_ENV', defaultValue: 'staging', description: '')
text(name: 'DEPLOY_TEXT', defaultValue: 'RnD\nJenkins\nPipeline\n', description: '')
booleanParam(name: 'Are You Have Permission to Deploy', defaultValue: true, description: 'Toggle this value')
choice(name: 'CHOICE', choices: ['One', 'Two', 'Three'], description: 'Pick something')
file(name: 'FILE', description: 'Some file to upload')
password(name: 'PASSWORD', defaultValue: 'SECRET', description: 'A secret password')
}
stages{
stage('string'){
steps{
echo " string $DEPLOY_ENV"
}
}
stage('text'){
steps{
echo " text $DEPLOY_TEXT"
}
}
stage('booleanParam'){
steps{
script{
if(TOGGLE){
echo " now execute, booleann is true"
}else{
echo " Dont execute, boolean is true"
}
}
}
}
stage('choice'){
steps{
script{
if(DEPLOY_ENV=='staging'){
echo " choice $CHOICE"
}
}
}
}
stage('file'){
steps{
echo " file $FILE"
}
}
stage('password'){
steps{
echo " password $PASSWORD"
}
}
}
}
Output:

Parallel Execution in Jenkins pipeline:
We will be focusing on the parallel build using the Jenkins declarative pipeline in our Jenkins Pipeline Tutorial now. So you can trigger your build system by Jenkins if there are some steps that could possibly run at the same time since they have no dependencies. By following this method, you will speed up your build process and save time for other sequential steps. As one of the best automation testing service providers, we don’t just stop with using the best tools, we also focus on using them in the best way possible.

Parallel Execution:
pipeline {
agent any
stages {
stage ('My Java Project Test Scenarios'){
parallel {
stage('Unite Test'){
steps {
echo 'Unit test Completed'
sleep 5
}
}
stage('Integration Test'){
steps {
echo 'Integration Completed'
sleep 5
}
}
stage('Security Test'){
steps {
echo 'Security Completed'
sleep 5
}
}
stage('Selenium UI Test'){
steps {
echo 'Selenium UI Test Completed'
sleep 5
}
}
}
}
}
}
Output:

Conclusion
We hope you enjoyed reading our Jenkins Pipeline Tutorial and found it to be informative at the same time. As promised we have covered everything including the basics of the Jenkins pipeline, seen its advantages, explored all the perquisites like variables and parameters that you will need to know to use it effectively. So make sure you don’t just try the Jenkins pipeline, make sure you use it effectively.
by admin | Nov 1, 2021 | Mobile App Testing, Blog, Latest Post |
Automation tests are a crucial part of the process that makes sure your iOS app is up-to-par with the required standards. We can say without any doubt that the bar has been raised to new heights because of the standards set by Apple. Automation testing on their end is highly standardized. The apps must go through rigorous checks before they can be approved for the App Store. The parameters include numerous guidelines set by Apple that are followed up with strict implementation rules. The XCUITest framework not only allows you to execute automated functional and performance checks but also shares information across devices in order to identify any inconsistencies between them before it’s too late! So in this blog, we will discuss how the XCUITest framework will be instrumental in helping you meet the high standards set by Apple.
Though the XCUITest framework is a popular tool from Apple, it’s still an independent module with many features that can be harnessed by any developer in the industry – even beginners! We know that XCUITest provides a framework that can be used for testing your iOS app. Since it supports Swift and Objective-C languages, it allows you to write tests in either of these programming languages instead of coding directly with Xcode or using another tool like StoryTest. These interactions are more realistic since they reflect how users will interact with your mobile application on their own devices rather than just simulating this behavior through code while being tethered by wires during development – it makes integration easy!
As one of the best mobile app testing companies, we have been able to use XCUITest in our projects to reap the wonderful benefits it has to offer. So let’s explore the tool’s potential by understanding the need.
UI Automation Testing
UI Automation Testing is a relatively new practice and has only recently started becoming popular among software engineers who want more control over how their work gets tested before it goes live. Frameworks like XCUITest allows testers to develop clean automation test suites for an app’s UI. These tests can run on different devices to check if the apps work properly regardless of the type or size of the screen you use them on. This makes it very convenient when testing apps that have international versions available but aren’t yet localized. Now let’s take a look at a few benefits UI automation testing has to offer.
Preserving Time and Money
Automation will pay off your investment with far greater returns as time goes on. The primary reason is that UI has such an important role to play in helping the customer feel satisfied with any application. A poorly designed UI has the potential to single-handedly derail your app’s success.
Automating Code isn’t Sufficient
UI testing shouldn’t be seen as something that has to be ticked off in your checklist. It is one of the best methods to ensure that your application works perfectly. Many developers use third-party frameworks like Appium to automate repetitive tasks to save time and to be more thorough. Developers must also perform code test cases to check the behavior and interactivity with the other modules. But the issue here is that they do not have any metrics that show how development sprint cycles or new builds affect UI functionality.
For example, if it takes more than the expected time to load or if some change has rendered any component from the previous release to become non-functional now. There are so many more similar scenarios that could happen. So the developers will be at risk when automating manual tasks using Test Automation Frameworks like Appium. These tools are only useful to automate parts of an automated assessment, whereas, the entire context needs attention. That is why tools like XCUITest and XCTest are very crucial.
Basics of the XCUITest Framework
With XCUITest, testers can write test cases to check how an application behaves when user actions are performed and compare the results they get with the expected outcomes. Using the two fundamental concepts behind XCUITest, they will be able to precisely monitor what a person would experience while using your app by utilizing their input device or system. They would also be able to validate the current state at any given time based on the documented interactions from the earlier tests to simulate real-life use conditions before the release.
XCTest
XCTest is the base testing framework for both iOS and OSX apps. It provides testers with various tools to write test cases in either Objective-C or Swift, to create UI tests classes (e.g., methods), and to assert the behavior validation when running them through Xcode. So all of this would be seamlessly integrated at your fingertips with XCTest!
Accessibility Features
QAs can also add accessibility features to the apps for people with disabilities. Accessibility technology has given QAs a new way of testing the app’s functionality when it is being used by someone who may not be able to use conventional input methods or have full access to all the components on the screen. So the UI test cases are created using functions provided within the Accessibility Core library that executes and validates tests against various parameters including size changes in width/height values. Changing these values will paint us a clear picture of how our program behaves differently depending on the user’s perspective.
XCUIApplication
Every time testers need to automate a test for an app, they have to ensure that it’s launched by specifying the XCUIApplication instance and calling the launch method on this object before the testing even begins. It should also terminate once all of its tasks have been completed so that no lingering processes are left behind after the tests have finished running. It will help to avoid any problems with sensitive data being leaked or tampered with during the analysis stage.
XCUIElement
The XCUITest framework provides a suite of components to help UI testers with their tests. These elements can be used in different ways, such as navigating & interacting within the view or performing actions like tapping & swiping on the screen. The class is responsible for handling these interactions between the user input devices (such as touchscreens) and the app logic. It also grants you access to look into how an element hierarchy unfolds — this way; we know which parts will respond when interacted with by our users!
XCUIElementQuery
The XCUIElementQuery is one of the most important classes in the UI framework. This class will allow testers to search for a particular element on that user interface, perform some action, and then move on to another task!
Conclusion
Xcode has many built-in features which allow developers of all levels to quickly explore potential bugs in their software before releasing them on the App Store. Plus, getting started is fairly easy for any iOS developer as it can be done without having to learn a new framework or language. As one of the best software testing companies in India, we always make sure to use the best tools and wrote this blog to help others understand the importance of XCUITest.
XCUITest is a powerful tool to help you find issues in your app’s code and pinpoint the root cause. With XCUITest, we can fiddle with our apps’ UI elements and ensure that end-users do not encounter unexpected results or have poor experiences. It provides an excellent way to test mobile apps, but it will only work if the tests are running on real devices or in emulated environments with XCUI Automation Platform integration enabled – which gives us total control over the computing resources during our automated testing sessions.
by admin | Oct 29, 2021 | Selenium Testing, Blog, Latest Post |
When you are testing a web-based application, it is pivotal to ensure that they work without any issues in the browsers that are predominantly used by the world. Selenium WebDriver is a great tool that allows QA professionals to automate their test cases in their desired browser by using its library and a language-specific framework. As a leading QA company, we believe the ability to run Selenium WebDriver in different browsers is a basic skill every automation tester must possess. So we have written this blog to provide a comprehensive guide to the ones looking to learn how to run Selenium WebDriver in browsers like Chrome, Firefox, Safari, Opera, and Edge. So let’s get started with a few basics of Selenium and move forward from there.
Selenium
Selenium is a popular test automation tool that was developed by Jason Huggins in 2004 at Thought Works. It is an open-source automated testing framework for web applications that works with different languages such as JavaScript (Node.js), Python, Ruby, Java, or C#.
Different Types of Selenium:
- Selenium IDE
- Selenium RC
- Selenium WebDriver
- Selenium Grid
Selenium WebDriver:
We have already established how Selenium WebDriver can be instrumental in testing a web application across different browsers. But before you can get started with your browser automation, you should make sure to download the browser-specific drivers. Also ensure that the driver is compatible with your OS (Windows, Mac, or Linux).
Though we will be guiding you to run Selenium WebDriver in Safari that runs only on macOS, we will be focusing on how you can run Selenium WebDriver in the other browsers on Windows.
Different types of WebDriver:
1. Firefox
2. Opera
3. Chrome
4. Edge
5. Safari
Both developers and QAs have the liberty to choose the programming language of their choice all thanks to the wide range of language bindings that the Selenium developers have developed.
Now, let’s see a list of software that you will have to download onto your system to successfully automate your browsers. Make sure you download the most recent and stable releases.
1. Selenium Java Stable 4.0.0
2. JDK
3. IntelliJ IDEA
Environment setup:
Setting up an environment for testing is one of the very first actions we would be doing. So let’s see how to do that in Java.
- Open ‘Edit the System Environment Variables’ options by searching for it in the Search Box.
- Click on ‘Environment Variables’ -> Click the ‘New’ Button
- Enter the variable name as ‘CLASSPATH’, and enter the following variable value ‘C:\ProgramFiles\Java\jdk-17.0.1\lib\*.jar’.
- Click the ‘New’ button again.
- Enter Variable name ‘JAVA_HOME’ and Variable value ‘C:\Program Files\Java\jdk-17.0.1’.
Once it has been downloaded, verify it in your system without fail. You can do that by opening command prompt and typing java–version and clicking Enter. If there are no issues, you will see the details of the Java & JDK versions.
IntelliJ IDEA
- Open IntelliJ. Click File -> New -> Project -> Click Java -> Select Project SDK -> Next -> Select the “Checkbox” to Create project from template, Click ‘Next’ -> Give a name for the Project, and click on Finish.
- Click on ‘File’ -> Project Structure -> Platform Settings ->SDKs to Add Classpath ‘+’.
- Open the Selenium file and navigate to the Lib folder, select ‘All Jar Files’ and click on ‘Apply’.
- Make you sure downloading Selenium Webdriver in any compatible browser on your windows . Click the URL and go to navigate the Platforms Supported by Selenium and click the browser then you can the webdriver then download the documentation.
- Must you verify the browser version of the webdriver is here , then you can download and use it .
The syntax for the WebDriver
//System.setProperty ("webdriver.chrome.driver"," Enter the driver path with driver name.exe "); //
Keywords for Selenium:
In order to understand the sample codes that we have written, you have to know a few basic keywords that are used to perform certain actions in the automation process. We have just mentioned a few basic keywords, if you are looking to get a better understanding, make sure to check out our blog that will help you with it.
Action:
We can use these keywords to open a particular website, reload it, close it, and such other actions.
driver.get ("URL");
driver.navigate ().to ("URL");
driver.navigate ().refresh ();
driver.navigate ().forward ();
driver.navigate ().back ();
driver. Close ();
Locators:
These keywords are used to locate the elements using Selenium. Each keyword uses a different method and it can be easily understood by their names.
driver.findElement(By.id(""));
driver.findElement(By.name(""));
driver.findElement(By.xpath(""));
driver.findElement(By.cssSelector(""));
driver.findElement(By.linkText(""));
driver.findElement(By.partialLinkText(""));
Code to Run Selenium WebDriver in Multiple Browsers:
We have written sample programs that will help you understand the changes you’ll have to make when using each browser. So let’s take a look at each of them one by one.
Sample Program for Chrome:
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;
public class Main {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver","D:\\Webdriver\\chromedriver_win32 (2)\\chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.get("https://www.snapdeal.com/");
driver.manage().window().maximize();
WebElement element =driver.findElement(By.cssSelector("ul[class='nav smallNav']>li[navindex='4']"));
Actions action = new Actions(driver);
action.click(element).perform();
WebElement element2 =driver.findElement(By.xpath("//span[text()='Keyboards']"));
Actions actions = new Actions(driver);
actions.doubleClick(element2).perform();
driver.findElement(By.id("searchWithinSearch")).sendKeys("logitech");
driver.findElement(By.id("swsIco")).click();
driver.navigate().to("https://www.snapdeal.com/product/logitech-k120-black-usb-wired/636481286288");
driver.findElement(By.id("buy-button-id")).click();
driver.close();
}
}
Sample Program for Firefox:
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;
import java.util.concurrent.TimeUnit;
public class Main {
public static void main(String[] args) {
System.setProperty("webdriver.gecko.driver","D:\\Webdriver\\geckodriver-v0.29.1-win64\\geckodriver.exe");
WebDriver driver=new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.MICROSECONDS);
driver.manage().window().maximize();
driver.get("http://www.leafground.com/pages/Dropdown.html");
Select Select_training_program_using_Index1 = new Select( driver.findElement(By.xpath("//select[@id='dropdown1']")));
Select_training_program_using_Index1.selectByIndex(1);
Select Select_training_program_using_Index2 = new Select( driver.findElement(By.xpath("//select[@name='dropdown2']")));
Select_training_program_using_Index2.selectByValue("2");
Select Select_training_program_using_Index3 = new Select( driver.findElement(By.xpath("//select[@id='dropdown3']")));
Select_training_program_using_Index3.selectByVisibleText("UFT/QTP");
Select Get_the_number_of_dropdown_options = new Select( driver.findElement(By.xpath("//select[@class='dropdown']")));
Get_the_number_of_dropdown_options.getWrappedElement().sendKeys("Loadrunner");
}
}
Sample Program for Microsoft Edge:
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.edge.EdgeDriver;
public class Main{
public static void main(String[] args) {
System.setProperty("webdriver.edge.driver","C:\\Users\\Admin\\Downloads\\edgedriver_win32\\msedgedriver.exe");
WebDriver driver= new EdgeDriver();
driver.manage ().window().maximize();
driver.manage().deleteAllCookies();
driver.get("https://facebook.com ");
driver.findElement(By.id("email")).sendKeys("7418894451");
driver.findElement(By.name("pass")).sendKeys("99664475");
driver.findElement(By.xpath("//button[@name='login']")).click();
driver.close();
}
}
Sample Program for Opera:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.opera.OperaDriver;
import java.util.concurrent.TimeUnit;
class Main{
public static void main(String[] args) {
System.setProperty("webdriver.opera.driver","C:\\Users\\Admin\\Downloads\\operadriver_win64 (1)\\operadriver_win64\\operadriver.exe");
WebDriver driver=new OperaDriver();
driver.manage().window().maximize();
driver.manage().deleteAllCookies();
driver.get("https://www.google.co.in");
driver.manage().deleteAllCookies();
driver.navigate().to("https://codoid.com");
driver.manage().window().fullscreen();
driver.navigate().back();
driver.navigate().refresh();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.MICROSECONDS);
driver.navigate().forward();
driver.manage().window().fullscreen();
driver.close();
}}
Run the WebDriver in the Safari browser
So as promised, now we are going to explore the two processes you’ll need to do to run Selenium WebDriver in Safari. Following this, we have a test script for the Safari driver to run. It is worth noting that we’d have to run an automation test in the Safari browser to enable this option.
Process 1
Step 1: Open the Safari browser and navigate to the Preferences.
Step 2: Enable the ‘Show Develop Menu’ on the Menu bar.
Step 3: Now you’ll see the new Develop option popup on your safari menu bar.
Step 4: Click on ‘Allow remote automation’.
Step 5: Once that is done, you’ll be able to run the web driver successfully.
Syntax:
Webdriver driver = new Safari Webdriver ();
//Since this Safari WebDriver there is no need to set the path of the driver for the respective browser, instead you would have to do it for the system.
For example,
System.setProperty("webdriver.safari.driver","C:\\Admin\\safaridriver(1)\\safaridriver.exe");
//Apple developed a Safari WebDriver that is compatible with all the safari browsers.
//If you can’t run a Safari WebDriver, you can activate the WebDriver by following Process 1.
Sample program for Safari:
package com.company;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.safari.SafariDriver;
public class Main{
public static void main(String[] args) {
WebDriver driver=new SafariDriver();
driver.get("https://codoid.com/ ");
driver.close();
}}
Conclusion
We hope you found this blog informative as a majority of software testers use Selenium WebDriver to automate their tests in different browsers. As one of the prominent automation testing service providers in the arena, we ourselves have been ardent users of Selenium WebDriver to automate our tests.
by admin | Oct 28, 2021 | Web Service Testing, Blog, Latest Post |
Long gone are the days where websites were predominantly accessed from desktops as people have started accessing websites from laptops, tablets, smartphones, and even smartwatches. There are countless models that have different screen resolutions and sizes under these categories as well. So you will be in deep trouble if you’re website doesn’t have a responsive design, as you will be driving away a massive chunk of your audience due to the poor design. It is not just about the aesthetic feel your design has to offer, functionality is also a crucial part of being responsive. Though bounce rate is an aspect to worry about, your website will not even be able to rank and reach people if your website isn’t mobile-friendly. Now that we have established why we need to test your website at different screen resolutions, let’s find out how.
There are various solutions that will enable you to test your website at different screen resolutions. As a leading QA company, we have shortlisted the best options for this blog.
Dev Tools
Understanding the growing need for websites to be responsive, many prominent browsers have made it easier for testers or developers to check it using Dev Tools. According to reports, the 4 most popular browsers are Google Chrome, Safari, Microsoft Edge, and Mozilla Firefox.
- In most cases, a regular right-click on any part of the website you want to test will show an option called ‘Inspect’ in the dropdown list. You can click on it to launch the Dev tools and the emulator along with it.
- Once Dev tools has been launched you can define the screen resolution as you choose or even choose from the list of predefined screen resolutions that come along with it.
- If you are testing a new device, then you can even add the custom resolution and save it by giving a name to reuse it whenever needed. You can refer to the below visual to see how it can be done in a few easy steps.

Unlike Google Chrome and Microsoft Edge Mozilla Firefox will not launch the emulator directly. Once the Dev tools window has been launched, you have to look for an icon that denotes a mobile and a tablet together and click it, or press ctrl+shift+M to launch the emulator.
When it comes to Safari, you first have to follow this series of actions.
- Click on ‘Preferences’ -> Advanced.
- In the menu that appears, you have to enable the ‘Show Develop menu in menu bar’ checkbox.
- Now, you will be able to view the ‘Develop’ menu in the menu bar. Click on that and select the ‘Enter Responsive Design Mode’ option.
The conventional way to launch Dev Tools for the other 3 browsers would be opening the ‘Menu’, navigating to ‘More Tools’, and then opening Developer tools.
BrowserStack
The first option we saw makes use of emulators to help test your website at different screen resolutions. But if you are looking to take it a notch higher and perform the test on real devices, then definitely buying all the devices in the market will not be a viable option. Here is where a tool like BrowserStack will come in handy as it is a cloud-based platform that will let us use real devices to test. Apart from using real devices for better assurance, BrowserStack will be instrumental in testing cross-browser functionalities. As one of the best mobile testing companies, we have used BrowserStack to great success in many of our projects. Though there are other similar tools, we believe BrowserStack to be the best.
Testing on Foldable Devices
Foldable devices introduce innovative screen configurations that require a thorough testing strategy to ensure your website remains responsive and user-friendly. Here’s a detailed guide:
1. Dual-Screen and Single-Screen Modes
- Scenario Testing: Test how your website appears in both folded (single screen) and unfolded (dual screen) states. For example:
- A gallery might span across two screens when unfolded but compress into a single scrollable column when folded.
- Content Flow: Check if content flows seamlessly between screens without truncation or misalignment.
2. Viewport and Screen Ratios
- Foldable devices often have non-standard aspect ratios, like square or ultra-tall screens. Ensure your website:
- Adapts dynamically to screen size changes.
3. Multi-Window and App Continuity
- Test how your website behaves in multi-window setups:
- Split-screen: Ensure UI components resize correctly when your site shares the screen with another app.
- Drag-and-drop interactions: Test any cross-window functionalities for seamless operation.
- App continuity testing ensures the site state persists during transitions between folded and unfolded modes.
4. Interaction Zones
- Foldable hinges may introduce non-interactive zones:
- Verify that essential buttons or links aren’t placed over these areas.
- Test gestures like swiping across the hinge or tapping near it.
5. Testing Tools
- Browser DevTools:
- Chrome DevTools: Offers presets for foldable devices like Samsung Galaxy Fold.
- Microsoft Edge: Includes dual-screen testing tools for Surface Duo.
- Real Devices:
- Physical testing on devices like Galaxy Z Fold or Surface Duo helps uncover hardware-specific quirks.
- Emulators and Simulators:
- Tools like Android Studio can emulate foldable scenarios for testing without physical devices.
Look beyond the norm
The conventional screen sizes we can see on a laptop or desktop are 1920×1080 and 1366×768. But many users are beginning to transition to desktop monitors and laptop displays with 2K & 4K resolutions. Also keep in mind that beyond the 16:9 aspect ratios that we are used with, there is also a rise in the usage of 16:10 aspect ratio displays that have different screen resolutions. These kinds of screen resolutions are mainly used by creators and it is sure to catch on as Apple has also been using this aspect ratio with their new range of laptops. The mobile devices we use nowadays are all touch screens, and many laptop displays are also getting touch displays. So make sure to design your websites for touch input to stay future-proof.