Thursday, 22 December 2022

How to auto save files using a custom Firefox profile-Selenium Python?

 


If you are new to PYTHON then first check the post on How to Install Python on windows and mac?, once installation is complete then only checkout the below Q&A


If you are preparing for Selenium-Python Interview then also check below Q&A:


Python Interview Question & Answers Set - 01

Python Interview Q&A Set - 02

Python Interview Q&A Set - 03

How to auto save files using a custom Firefox profile?

The first step is to identify the type of file you want to auto save.

To identify the content type you want to download automatically, you can use curl:

curl -I URL | grep "Content-Type"

Another way to find the content type is by using the requests module, you can use it like this:

import requests
content_type = requests.head('http://www.python.org').headers['content-type']
print(content_type)

Once the content type is identified, you can use it to set the firefox profile preference: browser.helperApps.neverAsk.saveToDisk

Here is an example:

import os

from selenium import webdriver

fp = webdriver.FirefoxProfile()

fp.set_preference("browser.download.folderList",2)
fp.set_preference("browser.download.manager.showWhenStarting",False)
fp.set_preference("browser.download.dir", os.getcwd())
fp.set_preference("browser.helperApps.neverAsk.saveToDisk", "application/octet-stream")

browser = webdriver.Firefox(firefox_profile=fp)
browser.get("http://pypi.python.org/pypi/selenium")
browser.find_element_by_partial_link_text("selenium-2").click()

In the above example, application/octet-stream is used as the content type.

The browser.download.dir option specify the directory where you want to download the files.

How to use Selenium with remote WebDriver in Python?

 


SDET Interview Question and Answers.  

Jenkins Interview Questions and Answers. 

Appium Interview Questions and Answers

Selenium Interview Questions and answers. 

GIT Interview Questions and Answers


If you are preparing for Selenium-Python Interview then also check below Q&A:
Python Interview Question & Answers Set - 01

Python Interview Q&A Set - 02

Python Interview Q&A Set - 03


If you are new to PYTHON then first check the post on How to Install Python on windows and mac?, once installation is complete then only checkout the below Q&A

Using Selenium with remote WebDriver

To use the remote WebDriver, you should have the Selenium server running. To run the server, use this command:

java -jar selenium-server-standalone-2.x.x.jar

While running the Selenium server, you will see a message that looks like this:

15:43:07.541 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub

The above line says that you can use this URL to connect to the remote WebDriver. Here are some examples:

from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

driver = webdriver.Remote(
   command_executor='http://127.0.0.1:4444/wd/hub',
   desired_capabilities=DesiredCapabilities.CHROME)

driver = webdriver.Remote(
   command_executor='http://127.0.0.1:4444/wd/hub',
   desired_capabilities=DesiredCapabilities.OPERA)

driver = webdriver.Remote(
   command_executor='http://127.0.0.1:4444/wd/hub',
   desired_capabilities=DesiredCapabilities.HTMLUNITWITHJS)

The desired capability is a dictionary. So instead of using the default dictionaries, you can specify the values explicitly:

driver = webdriver.Remote(
   command_executor='http://127.0.0.1:4444/wd/hub',
   desired_capabilities={'browserName': 'htmlunit',
                         'version': '2',
                        'javascriptEnabled': True})

****************************************

TOP 15 BDD - CUCUMBER Interview Q&A


************************************************

✍️AUTHOR: LinkedIn Profile

************************************************

Learn (API-Microservice)Testing+ Selenium UI Automation-SDET with Self Paced Videos prepared by FAANG employees and LIVE Doubt Session 

SDET TRANING VIDEOS AVAILABLE with Live Doubt Session(course-1 below,API TRaining Videos With Class Notes and Coding Set) and (API+UI, both course-1 & 2 below) Check Training Page for Course Content or reach out @whatsapp +91-9619094122. 
This includes classnotes, 300+ interview questions, 3 projects, Java Coding question set for product companies along with career guidance from FAANG employees for Automation and SDET.

For more details whatsapp : https://lnkd.in/dnBWDM33

*************************************************

SeleniumWebdriver Automation Testing Interview Questions:

https://automationreinvented.blogspot.com/search/label/SeleniumWebdriver

API Testing Interview Question Set:

https://automationreinvented.blogspot.com/2022/03/top-80-api-testing-interview-questions.html

DevOps Interview Q&A:

https://automationreinvented.blogspot.com/2021/11/top-11-devops-interview-questions-and.html 

Kubernetes Interview Question Set

https://automationreinvented.blogspot.com/search/label/Kubernetes

Docker Interview Question Set

https://automationreinvented.blogspot.com/Docker

Linux Interview question Set

https://automationreinvented.blogspot.com/search/label/Linux

Automation Testing/SDET Framework Design

https://automationreinvented.blogspot.com/search/label/FrameworkDesign

Java Related Interview Question Set

https://automationreinvented.blogspot.com/search/label/Java

GIT Interview Question Set:

https://automationreinvented.blogspot.com/2021/09/top-40-git-interview-questions-and.html

Coding Interview Question Set:

https://automationreinvented.blogspot.com/search/label/Coding%20Questions

Mobile Testing Interview Question Set:

https://automationreinvented.blogspot.com/search/label/Mobile%20Testing

Python Interview Question Set for QAE - SDET - SDE:

https://automationreinvented.blogspot.com/search/label/Python


How to write the first Python Selenium script with Basic Commands?

 

SDET Interview Question and Answers.  

Jenkins Interview Questions and Answers. 

Appium Interview Questions and Answers

Selenium Interview Questions and answers. 

GIT Interview Questions and Answers


If you are new to PYTHON then first check the post on How to Install Python on windows and mac?, once installation is complete then only checkout the below Q&A


If you are preparing for Selenium-Python Interview then also check below Q&A:
Python Interview Question & Answers Set - 01

Python Interview Q&A Set - 02

Python Interview Q&A Set - 03


How to write the first Python Selenium script with Basic Commands?


from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service as ChromeService
from webdriver_manager.chrome import ChromeDriverManager


def test_eight_components():
    driver = webdriver.Chrome(service=ChromeService(executable_path=ChromeDriverManager().install()))

    driver.get("https://www.selenium.dev/selenium/web/web-form.html")

    title = driver.title
    assert title == "Web form"

    driver.implicitly_wait(0.5)

    text_box = driver.find_element(by=By.NAME, value="my-text")
    submit_button = driver.find_element(by=By.CSS_SELECTOR, value="button")

    text_box.send_keys("Selenium")
    submit_button.click()

    message = driver.find_element(by=By.ID, value="message")
    value = message.text
    assert value == "Received!"

    driver.quit()


****************************************

TOP 15 BDD - CUCUMBER Interview Q&A


************************************************

✍️AUTHOR: LinkedIn Profile

************************************************

Learn (API-Microservice)Testing+ Selenium UI Automation-SDET with Self Paced Videos prepared by FAANG employees and LIVE Doubt Session 

SDET TRANING VIDEOS AVAILABLE with Live Doubt Session(course-1 below,API TRaining Videos With Class Notes and Coding Set) and (API+UI, both course-1 & 2 below) Check Training Page for Course Content or reach out @whatsapp +91-9619094122. 
This includes classnotes, 300+ interview questions, 3 projects, Java Coding question set for product companies along with career guidance from FAANG employees for Automation and SDET.

For more details whatsapp : https://lnkd.in/dnBWDM33

*************************************************

SeleniumWebdriver Automation Testing Interview Questions:

https://automationreinvented.blogspot.com/search/label/SeleniumWebdriver

API Testing Interview Question Set:

https://automationreinvented.blogspot.com/2022/03/top-80-api-testing-interview-questions.html

DevOps Interview Q&A:

https://automationreinvented.blogspot.com/2021/11/top-11-devops-interview-questions-and.html 

Kubernetes Interview Question Set

https://automationreinvented.blogspot.com/search/label/Kubernetes

Docker Interview Question Set

https://automationreinvented.blogspot.com/Docker

Linux Interview question Set

https://automationreinvented.blogspot.com/search/label/Linux

Automation Testing/SDET Framework Design

https://automationreinvented.blogspot.com/search/label/FrameworkDesign

Java Related Interview Question Set

https://automationreinvented.blogspot.com/search/label/Java

GIT Interview Question Set:

https://automationreinvented.blogspot.com/2021/09/top-40-git-interview-questions-and.html

Coding Interview Question Set:

https://automationreinvented.blogspot.com/search/label/Coding%20Questions

Mobile Testing Interview Question Set:

https://automationreinvented.blogspot.com/search/label/Mobile%20Testing

Python Interview Question Set for QAE - SDET - SDE:

https://automationreinvented.blogspot.com/search/label/Python


 


Friday, 25 November 2022

Centralised Test Management & Integrated Automation

 



Introduction

Today’s era is all about the adoption of automation to 

leverage manual tasks, and the impact is quite visible

in the Software Testing field too.

However, the major concern here is to utilise 

the existing functional resources for Automation.

Usually functional QAs are well aware of the 

functionality of the product, so they can easily 

identify the areas for automation and also contribute

for execution. 


Currently, most of the existing tools and frameworks

in the market divide the manual and

automation execution, due to which the QA team

ends up using two different tools to

run the manual and automation suite.

A typical scenario is where the functional team 

is using a Test Management tool

to create test runs and execute scenarios manually 

and the automation team is using

Jenkins to trigger the automation test suite.

The ideal solution would be a centralised test 

management system which unites manual and 

automated testing in a single interface.

By doing this we are giving leverage to functional QA who can easily trigger automation suites from the same test management system where they are triggering the manual test runs. 

Isn’t it something all QAs are eagerly waiting for?

TestGear solves this problem statement for QAs and 

Provides us with a single space for automated and 

manual testing with transparent reporting. 



TABLE OF CONTENTS:

TestCase Management with TestGear

Create Project

Create TestCase

Create TestPlan

Create Error Categories

Create Configurations

Automation Trigger From TestGear

How to add Automation Tests?

Automation Test Mapping with Manual Test Cases

Execute Automation Tests

Public API to Integrate Autotests

Reporting

Conclusion


TestCase Management with TestGear

In this section we will explore different tasks performed by 

Functional QA in day to day work.

Let’s start with the setup process with TestGear,

the prerequisite to reach here is to have

valid login credentials to access TestGear.

Once you Login, the empty Projects screen should be 

visible as shown below:

(if you don’t have an account then you can try TestGear

for free with a trial account at the link HERE). Remember that for the very first time when you login 

the Workspaces tab opens,

Click on Create Workspace and then Enter a name 

for your new workspace and click Save.


Create Project

Before we can proceed with project creation, remember

to add a workspace as mentioned

above which will help us to manage the project efficiently

. As shown in the above screenshot

Click Create project. A project creation window opens

and then enters the project name and

description. Once the details are filled out, click on 

the Save Button

After creation, your new project opens on the Tests tab. 

Check the below screenshot where a new project has been created and some testcases have been tagged, 

we will learn about test case creation in the next section.

Create TestCase

To create a test case, select Test case as the kind of 

test you want to create for the selected project. In the modal test-case-creation window that appears, 

enter a name. The Comments and Change history 

tabs are unavailable. 

Check the below screenshot where testcase has been create with name as

“Verify Login”, but the point which standout is how 

we can utilise the right section where we can define the values like execution duration

(10m in Screenshot), priority (medium in the screenshot) and state as Not ready.


Create TestPlan

A test plan is a document that describes the goals,

approaches, resources, and schedule of planned test activities. 

To work on TestPlan creation, first open the Test plans section.

To create a new test plan, press the Create button.

Fill out all the details as shown below and click on 

the SAVE button:


Create Error Categories

This is one of the best things about TestGear, 

we can tag defects as per three different categories Product, Infrastructure and Autotest.

You can visit the same by going to the 

Autotests ⇒ Error categories as shown in the below 

screenshot:


Create Configurations

Open the Configurations section and press the 

Create configuration button.

After that, a popup will open, enter the Name and 

Description and click on the Save button. Once it is added we will be able to see it as shown below:



Automation Trigger From TestGear

In my personal opinion, this is the best part of TestGear,

given the flexibility to trigger your automation test suite from the tool itself is the need 

of the hour. Now functional testers can easily trigger the automation 

suite and check the execution results, which will help the team to save time and raise 

defects immediately with execution results.

How to add Automation Tests?

You can create or add automated tests to TestGear

using Autocards via API.
Refer below steps to complete the Automation 

Test addition using Swagger API.

  1. Authorize in Swagger.

  2. In the AutoTests section, open the POST /api/v2/autoTests method.

  3. Click Try it out. The request body is open for editing.

  4. Specify the autotest external ID, the link to the autotest, the project ID, the pre-/postconditions of the test, and the steps.

  5. Click Execute. If the method executes successfully, the API returns code 201.

After you create an autotest using API, the autotest card 

is automatically created in TestGear. Using client libraries, we can trigger our automation suite

to understand the flow and get an idea of the implementation refer the post on 

Run Autotest From Client Libraries by TestGear.

Automation Test Mapping with Manual Test Cases

Linking autotests to test cases enables you to mark 

the test cases in the system as automated, and launch the linked autotests from test plans 

during execution. First let’s go to Autotests tab

  1. Open the project.

  2. Go to the Autotests section.

  3. Switch to the Autotests tab.

  4. Open the autotest card.

  5. Switch to the Related Test Cases tab.

  6. In the new related test case field, enter the name or global ID of the test case you want to link your autotest to.

  7. Click Save.

The autotest is now linked to a test case. View all linked test cases in the Related Test Cases field. A link to the autotest is automatically created in the test case.

Execute Automation Tests

If you have already created autotest cards, TestGear enables you to run your autotests from UI. This launch can be performed autonomously from test plans.

  1. Open the project.

  2. Select Autotests in the main toolbar.

  3. Switch to the Autotests tab.

  4. Select the autotests you want to launch using checkboxes.

  5. Click Launch autotests.

  6. In the pop-up window, select configurations for which you want to run autotests.

  7. Click Launch.

After launching, you will get a notification with a link to the test run. Click here to analyse the test failures

Public API to Integrate Autotests

TestGear gives you almost unlimited opportunities for integrating autotests and collecting results.

Interact with TestGear using an open API that enables you to create and launch autotests, import and export projects using a .json file, create work items, and much more. The full list of methods and their descriptions are stored in Swagger. You can use any API tool to interact with TestGear, for example, Postman.

Below are some of the APIs provided by TestGear, if you want to use those API then first need to generate the API secret key (refer link HERE for the steps to get the API key)



For a trial run and to check all the available APIs please refer to the link HERE.


Reporting


Reporting is one of the best features provided 

by TestGear.Apart from the default dashboard you can also use widgets which help to design 

different chart types like pie chart, trends, table and many more. 

Usually in every project  you can see an automatically 

built dashboard. This dashboard is available to every user in the project.

To open the project dashboard, open the project 

and switch to the Dashboards tab.

By default, the dashboard displays:

  • Test results trends.

  • Tests grouped by priority.

  • Tests grouped by readiness status.

  • Tests grouped by automation type.

  • Test plan results.

  • Team.

  • Section results table.

As mentioned earlier, to customise the data on your 

dashboard, add more widgets to visualise more data about the project.

Creating widgets is also very easy, you just need to click 

on the + icon in the bottom right section of the Dashboard page, it will open a popup where you 

can select the type of chart you want to create for your project, refer to the below screenshot:


Conclusion

Though everyone has a preempted idea that testing 

is easy to do, as a tester we know how painful it is to manage end to end testing and 

maintaining utmost quality. As a tester it is very important to stay organised 

while working with test cases and automated scripts.  We have tried our best to centrally manage, 

orchestrate, and analyse testing and by doing so provide a complete view of data-driven decisions 

to reduce risk and release faster. We provide a complete view of testing activities,

from ideas to production. 


We provide a central workspace that allows you 

to truly share and collaborate on testing across teams – not just a copy / fork challenge that results

in test sprawl and a maintenance headache, but true reusability to help you standardise and scale 

best practices.

With this note, we are signing off but please share 

with us your feedback on TestGear. We as a team keep on innovating different 

ways to help the QA community and organisations

to build errorless products with utmost quality.


For more details on TestGear do checkout the official website HERE

************************************************

✍️AUTHOR: LinkedIn Profile

*************************************************

SeleniumWebdriver Automation Testing Interview Questions:

https://automationreinvented.blogspot.com/search/label/SeleniumWebdriver

API Testing Interview Question Set:

https://automationreinvented.blogspot.com/2022/03/top-80-api-testing-interview-questions.html

DevOps Interview Q&A:

https://automationreinvented.blogspot.com/2021/11/top-11-devops-interview-questions-and.html 

Kubernetes Interview Question Set

https://automationreinvented.blogspot.com/search/label/Kubernetes

Docker Interview Question Set

https://automationreinvented.blogspot.com/Docker

Linux Interview question Set

https://automationreinvented.blogspot.com/search/label/Linux

Automation Testing/SDET Framework Design

https://automationreinvented.blogspot.com/search/label/FrameworkDesign

Java Related Interview Question Set

https://automationreinvented.blogspot.com/search/label/Java

GIT Interview Question Set:

https://automationreinvented.blogspot.com/2021/09/top-40-git-interview-questions-and.html

Coding Interview Question Set:

https://automationreinvented.blogspot.com/search/label/Coding%20Questions

Mobile Testing Interview Question Set:

https://automationreinvented.blogspot.com/search/label/Mobile%20Testing

Python Interview Question Set for QAE - SDET - SDE:

https://automationreinvented.blogspot.com/search/label/Python


 


 


All Time Popular Posts

Most Featured Post

𝗦𝘁𝗶𝗹𝗹 𝘀𝘁𝗿𝘂𝗴𝗴𝗹𝗶𝗻𝗴 𝘄𝗶𝘁𝗵 𝗝𝗮𝘃𝗮 𝗰𝗼𝗱𝗶𝗻𝗴 𝗿𝗼𝘂𝗻𝗱𝘀?

❓ 𝗦𝘁𝗶𝗹𝗹 𝘀𝘁𝗿𝘂𝗴𝗴𝗹𝗶𝗻𝗴 𝘄𝗶𝘁𝗵 𝗝𝗮𝘃𝗮 𝗰𝗼𝗱𝗶𝗻𝗴 𝗿𝗼𝘂𝗻𝗱𝘀? The issue isn’t your logic—it’s the lack of pattern recogniti...