Why and How to Automatically Translate a WordPress Site

Why and How to Automatically Translate a WordPress SitePersonalized content, friendly interfaces, and interactive themes help create engaging, accessible websites. But to truly reach a global audience, your website should speak your clients’ language. Fortunately, translating your site into any language is getting easier, quicker, and more affordable thanks to automatic translation options, also called machine translation, in many translation plugins. Why Translate […]

The post Why and How to Automatically Translate a WordPress Site appeared first on WPExplorer.

Best Office Suites Software

Businesses handle many tasks each day, from content creation to data analysis to sales and everything in between.

Office suite software boosts productivity through word processing, spreadsheet management, and other apps that showcase and track projects in the best way possible. Whether you need to calculate revenue or make a pitch presentation, the best office suites software tackle the job.

Although office suite software options have many similarities, they each have distinguishing features that may better align with your business needs. I’ve researched and tried some of the top options to break down how they stand out.

The Top 5 Best Office Suites Software

  1. Google Workspace – Best for collaboration
  2. Microsoft 365 – Best for desktop applications
  3. iWork – Best for Apple users
  4. WPS Office – Best for PDF editing
  5. Corel WordPerfect – Best for advanced users

Find an in-depth review of each software below to determine the best option for you and your business.

#1 – Google Workspace — Best For Collaboration

  • All apps included in each plan
  • Custom business email
  • 30 GB cloud storage
  • Pricing starts at $6/user/month
Try free for 14 days

Google Workspace has come a long way since its beginning in 2006. Now, the office suite includes an ample amount of apps to complete just about any project on your list of to-dos, from customizable forms with Google Forms to note-taking with Google Keep to the ultimate organization tool in Google Drive. 

This software is also the first of its kind to pioneer cloud-based apps. No matter where they are in the world, your team can open, edit, and modify any document you create with the Google Workspace suite. Document creators can share their projects with others using private links or having the app send an email notifying them of an invitation.

Teams can even work on documents simultaneously. Open a Doc or Sheet, and you’ll see an icon at the top right for everyone else currently viewing or editing that document. 

This suite even has Google Chat and Google Meet, chat and video apps that allow your team to communicate quickly and efficiently. Use them while working on projects in Google Workspace to keep everyone on the same page. The apps you’ll get with every plan include:

  • Calendar 
  • Chat
  • Currents
  • Docs
  • Drive
  • Forms
  • Gmail
  • Jamboard
  • Keep
  • Meet
  • Sheets
  • Sites
  • Slides

Although other software also offers cloud-based apps and file storage, Google Workspace entirely relies on a cloud model for each app. You can download files as needed, but if you prefer having a backup of everything stored in the cloud, this suite offers that.

Start using Google Workspace for just $6 per user per month for 30GB of storage per user in the Business Starter plan.  Business Standard for $12 per user per month boosts storage to 2 TB per user and allows video recording in Google Meet. All Workspace plans include custom, secure business emails, video meetings, cloud storage, security and management controls, and support

#2 – Microsoft 365 — Best For Desktop Applications

  • Desktop and cloud-based apps
  • 1 TB file storage
  • Online meetings with 300 participants
  • Pricing starts at $6/user/month
Try free for 1 month

It’s impossible to talk about the best office suites software without mentioning Microsoft 365, formerly Office 365. This complete suite of programs includes your basics, like word processing with Microsoft Word and presentations with PowerPoint. But you’ll also get email management with Outlook, video conferencing with Teams, storage with OneDrive, and spreadsheets with Excel. Depending on the plan, the suite also includes:

  • Exchange for team collaboration
  • SharePoint for sharing files and resources
  • OneNote for note-taking
  • Access for informational management
  • Publisher for professional desktop publishing
  • Intune for mobile device management

Microsoft 365 used to be local-focused, meaning that it included only desktop apps and local file saves. However, it’s since transitioned to more modern digital needs with web and mobile apps, too. But for teams searching primarily for desktop apps, it’s tough to beat Microsoft 365. 

Storing files locally is a must for businesses that want extra backups of files or those that prefer to share files via email. Having desktop apps on hand allows consistent access to them, even when a computer system might be offline. Plus, Microsoft 365’s desktop apps are fully featured, unlike the mobile and web apps that aren’t quite as in-depth and advanced.

To access desktop apps in addition to mobile and web apps, you’ll need the Microsoft 365 Business Standard plan for $12.50 per user per month. If having just mobile and web apps suits your needs, you can opt for Business Basic for $5 per user per month.

#3 – iWork — Best For Apple Users

  • Mobile and web apps
  • Works with Apple Pencil
  • Minimalist interface
  • 100% free
Try for free

Apple users have access to their own office suite software designed just for Apple devices, including Mac, iPhone, and iPad. However, even PC users can hop on the bandwagon by using iWork’s web apps, but they’ll need iCloud or Box to view and edit saved docs.

What I appreciate most about iWork is its minimalistic interface that’s ridiculously easy to pick up and start using immediately. It’s not surprising, as this type of design is something Apple is known for perfecting. But when it comes to an office suite, it’s beneficial to have all the tools you need at your fingertips in an orderly way.

With iWork, you’ll get Pages for word processing, Numbers for spreadsheets, and Keynote for presentations. While the suite doesn’t include numerous apps like others, it has the basics. Plus, these apps work well on smaller devices, like the iPhone, unlike some of the more complicated apps other office suites have. 

If there are any negatives with iWork, it’s that collaboration isn’t as great as it could be. Others can view and edit documents, spreadsheets, and presentations with proper permissions, but not all features are available to editors. Additionally, for a user to comment on a project, they’ll need editing permissions. For the best collaborative experience, I’d stick with Google Workspace.

You can download and use iWork for free from the website or App Store.

#4 – WPS Office — Best For PDF Editing

  • Document encryption
  • PDF editing and converting
  • Cross-platform functionality
  • Hundreds of templates
Try for free

Many businesses regularly use Portable Document Format (PDF) files to send resumes, web pages, and business forms to others within or outside the company. A PDF file keeps formatting from other document types intact, allowing everything to transfer to someone else or another platform without messing with its look.

However, PDFs are usually not editable unless you pay for an Adobe Acrobat subscription or use a free online editor that places watermarks on your document. WPS Office takes care of this, though, with its unique PDF editor and converter. Use the powerful PDF tools to sign, convert, edit, and compress PDF files.

The best office suites software goes beyond PDFs, though, and WPS Office tackles other pertinent stuff, too. The free plan includes 1 GB of free cloud storage, a file repair tool, up to 46 supported languages, and a full-powered word processor. The suite is available for Mac, Android, iOS, PC, Linux, and web.

To get full access to all PDF editing tools and other features, like 20 GB of cloud storage, ad-free operation, and image conversions, subscribe to premium for $29.99/year.

#5 – Corel WordPerfect — Best For Advanced Users

  • Professional photo editing tools
  • Microsoft Office compatibility
  • 300+ templates
  • Includes eBook publisher
Try for free

Corel WordPerfect is an all-in-one office suite software that includes a word processor, spreadsheet creator, and presentation maker. In addition to the basics, purchasers get WordPerfect Lightning for digital notetaking and Paradox for database management. 

Corel even throws in AfterShot 3, a premium photo-editing software, and Corel MultiCam Capture Lite, a video-capturing software, to create all the visual media you need to go along with your marketing.

The software consists of extensive features that you won’t find in many other office suite software. For instance, you can use Reveal Codes to view the actual code source for fonts and formatting, allowing you to tweak things down to minor details. And Redaction tools let you keep parts of documents private or automatically apply blocking to specified words and phrases. 

Other features advanced users might find helpful include:

  • Macro management
  • Mail merging tools
  • Bates numbering
  • Metadata removal
  • PDF security and archiving
  • Legal toolbar

Although Corel WordPerfect runs only on Microsoft products, it supports over 60 file formats, including those that Microsoft 365 uses. 

Corel WordPerfect is available in Standard, Home & Student, Family, and Professional editions starting at a one-time cost of $99.99. All editions include a 30-day money-back guarantee and a free trial.

How to Find The Best Office Suites Software For You 

After researching and reviewing many options, I chose the top six office suites software based on the following criteria: 

  1. Cloud vs. local saves
  2. Connected apps
  3. File extension and program compatibility
  4. Platform and device compatibility

These are necessary considerations for an office suite software user to ensure they’re getting a product that best fits their needs. The last thing you want is to spend money on something that doesn’t have the tools or compatibility you need for ultimate productivity.

To narrow the options, I thoroughly researched each product by digging into its website and help guides to learn more about its features and then testing the products myself with the available free versions. Free versions of tools give you an excellent idea of how the software will perform with specific functions and uses. 

Along the way, I kept the above criteria at the forefront of my reviews. Continue reading to learn why each criterion is important and what it might mean for your business.

Cloud vs. Local Saves

Cloud software has become increasingly popular in today’s digital age, where everything seems to float around in the cloud. Still, some office suite software options do not prioritize the cloud, relying on local file saves instead. 

Which model do you need? Cloud software allows you to save your files within the cloud, sometimes even with an autosave feature that automatically backs up your file without you needing to remember to hit the save button. For example, Google Workspace operates in the cloud and autosaves your work as you make changes.

Cloud software also allows for easy sharing and access by other authorized parties. For instance, you can share a Google Doc with someone else in your company and give them set permissions, like view-only or editor. Then, that person can open the file in the cloud without downloading anything or worrying about unsupported file extensions.

On the other hand, local saves only allow you to save files to your computer. Some programs offer an autosave feature as well, but the files will take up room on your system rather than use your cloud’s storage space. To share a file, you’ll need to send it to someone, such as by attaching it to an email. This can prove challenging for large files and annoying when sharing many files.

Then there are office suites that let you do both. Although Google Workspace prioritizes cloud-based operation, it also allows you to download and save files to your computer. And Microsoft 365 has long been a local-save suite but has also evolved to enable cloud storage through OneDrive. 

Connected Apps

Some office suites software includes several apps, while others offer just a few. The thing is, you might not need the 10+ apps that some suites come with and might charge more for. Although having everything at your fingertips in case you need them one day could be enticing, you shouldn’t spend extra to have more than you need now and in the immediate future.

Microsoft 365 and Google Workspace are both known for their extensive app collection. This could come in handy if you have a large business with several departments. Apps for word processing, data management, emailing, and presenting can give everyone on the team what they need.

But software like WPS Office and iWork give the basics: word processing, presentations, and spreadsheets. These are the most commonly needed apps, and they may be all your small to medium-sized business needs.

File Extension and Program Compatibility

If your team members use different office suites—this sometimes happens with large or remote teams—program and file extension compatibility are necessary. You want to make sure that your systems play well with each other when you send or share files with someone else to work with.

Nowadays, most office suites software works with Microsoft 365, as it’s admittedly a pioneer. As one of the most commonly used software packages, Microsoft 365 carries well-known extensions, like .docx and .pptx. Other suites, like iWork and Google Workspace, allow you to save documents with Microsoft Office extensions to seamlessly open in their respective apps.

However, the same isn’t true for other office suites software. Although several office suites work with Microsoft 365 files, it’s not unusual to experience formatting losses with the conversion. When a team member has spent hours on a document, spreadsheet, or presentation, you don’t want to worry about things not looking or behaving as they should.

If you work with people inside or outside of your company who use different suites, I suggest opting for one that’s more universally known and used, like Google Workspace, iWork, or Microsoft 365.

Platform and Device Compatibility

Do you want to access your office suite software on different devices, like a tablet or a Mac? If so, consider a suite with web-based and mobile apps, like Google Workspace and WPS Office. 

These suites let you access their software from just about anywhere, allowing you to log into your account to pull up your documents on a different computer or device. Plus, you can take them on the go to edit documents or spreadsheets while you travel or on your lunch break.

WPS Office is among the best in this area, offering local apps for Mac, PC, and Linux, along with a web-based app and mobile apps for Android and iOS. No matter what devices your team uses, they’ll be able to access the WPS Office suite.

Summary

When it comes to collaboration, Google Workspace takes the cake. This office suite is fully in the cloud, allowing users to edit and comment on documents and projects in real-time. But Microsoft 365 comes in a very close second with its sharing, editing, organizing, and meeting tools. Plus, cloud and desktop apps let users decide which format suits them best. 

Most businesses can’t go wrong using either of these options, but my other picks might be better for you, depending on the type of devices and files you work with most. For instance, Apple iWork is best for Apple-focused offices and users that don’t need all the extra apps other office suites software provides. 

Consider your budget and team’s needs before deciding. All options on this list are either free or have a free trial or version you can use to test them out before subscribing or buying.

How Is AI Used in Android App Development?

AI or Artificial Intelligence can be regarded as one of the most intriguing technologies that have been introduced in recent times. One can expect the AI industry to grow to $20 billion within the next couple of years. Consequently, this innovative technology is being adopted by many companies at present. 

Image Source: Google

Besides adopting AI technology, these companies are likewise trying to use it for the benefit of the folks. In this article, we discuss the role played by AI in Android app development at present.

How to Prepare for a Personal Data Compliance Audit

As the basis for the main requirements for data protection, we will consider the EU GDPR as the most pervasive and influential legislation in this area. In this article, we will skip the legal and organizational parts of the regulation which you can read elsewhere, and jump right in to explain what technical measures you can implement to get compliant.

If you have a compliance check scheduled you will need to have the following in place:

The Present and Future of RPA for Devs

We've touched on what goes into building a good RPA flow, so let's pull back a bit and look at the technology as a whole. Again, we're going to be tackling this from a developer's point of view, and again, we're going to rely on our friends from UiPath's dev team to help out.

(By the way, this is going to be a useful, but higher-level look at RPA. If you're looking for more of a tutorial, check out our Refcard Getting Started With Robotic Process Automation.)

Virtual Reality and Augmented Reality in the Browser

Introduction

This article about Progressive web apps is about implementing Virtual Reality (VR) and Augmented Reality (AR) in your web app. For this, we use A-Frame and the WebXR Web API.

VR moves users to another world and lets them experience it as if they were themselves in this virtual world. AR, on the other hand, offers the possibility to blend the real and virtual worlds into one another. Both VR and AR offer unique opportunities for behavioral change, knowledge transfer, training, and research. For example, think of VR live streaming, social VR, and art. All this is now also possible in the browser!

The Basics and Best Practices of Building RPA Flows

By this point, it should be clear that robotic process automation is going nowhere — and with good reason. The benefits of accuracy, compliance, and low technical barriers are pretty enticing to users. But what does that mean for companies and developers working on RPA? Maybe you're seeing more RPA-related tasks slipping into your sprints, or maybe you're just looking for a change of scenery in your job and want to sink your teeth into RPA.

Well, with that in mind, I reached out to the dev team at UiPath to get a developer's perspective on RPA. In this post, we'll focus on the basics, best practices, and limitations of RPA flows. In another article, we'll examine how the RPA landscape is changing.

Getting Started With OpenTelemetry

With the growing number of mass migrations to the cloud, OpenTelemetry solves new challenges by simplifying and reducing time spent on data collection through automation. OpenTelemetry is an open-source collection of tools, APIs, SDKs, and specifications with the purpose of standardizing how to model and collect telemetry data. OpenTelemetry has been proven to enable effective observability and it aims to become a standard of observability implementation.

In this Refcard, we introduce core OpenTelemetry architecture components, key concepts and features, and how to set up for tracing and exporting telemetry data.

New in Golang language

Hello.

I want to start studying the Golang language but I can't find any IDE that I can configure well, can you tell me an IDE that is good for Go and how to configure it (explained for fools in Spanish), please? I have tried with Sublime, Visual Studio Code and Eclipse and I have not clarified with any. And, if it is not too much to ask, can you recommend a free course to start studying (if possible in Spanish)? I have found a course but I ask if anyone knows of any good and free.

I really appreciate the help.

All the best.

A Brief Note on Log4perl

The Java world had an....interesting weekend when security researchers revealed on December 9 a vulnerability in the popular Apache Log4j 2 software library for recording and debugging events. Systems as diverse as Amazon Web Services, Apple iCloud, and the Minecraft video game could be exploited to run arbitrary code on a server merely by sending a specially-crafted string of text. Information technology professionals have been scrambling ever since the initial disclosure to patch, upgrade, reconfigure, or otherwise protect affected servers. It's bad, and past unpatched vulnerabilities like this have been responsible for the exposure of millions of people's sensitive data.

Many Perl applications use the similarly-named and ‑designed Log::Log4perl library, and the good news is that, as far as I can tell, the latter doesn't suffer from the type of vulnerability described above. This doesn't mean poorly-written or ‑configured Perl-based systems are immune to all exploits, just this particular one. You should be safe to continue using Log4perl unless someone has deliberately configured it otherwise, and in fact, my work uses it extensively.

Hi everyone how are you?

Hey guys,

How are you all? I'm a newbie here. I just signed up a few minutes ago. I would like to introduce myself with all.

Thank you so much for your time.

Inspirational Websites Roundup #32

Another month, another websites roundup! The end of the year is always a period where creativity peaks (and deadlines!) so we have an amazing selection for you to indulge in! There’s a slight trend of using sans serif typefaces and also mixed styles as we are already seeing for a while. Color themes are often toned down and we have lots of dark designs in this batch.

I hope you enjoy this collection and get inspired and up to date!

Адвент календарь 2022

Sagmeister & Walsh

Hard Work Club

Elite Design Studio

Henri Heymans

La puce à l’oreille

ListAcross

Luca Nardi

Roosh Ventures

BlueYard Capital

Ambidexter

Marvin Schwaibold

Joris Bijdendijk

Revolt

Antinomy Studio

Steven Boniface

Lama Lama

Grège

Green Room

Anatole Touvron

Shildan Group

L’Atelier

Jomor Design

PhysioAsten & Nnk

The Brand Identity

Atypikal Creative

Baillat Studio

Magnetism

21 Reflections of Dostoevsky in Pop Culture

Hyperframe

Aluminium

Dala

Paper Play

Clément Balavoine

ImReallyATRex

Daria IZbash

Aquerone

Vivid+Co

The post Inspirational Websites Roundup #32 appeared first on Codrops.

Modifying Headers In HTTP(s) Requests In UI Automation Testing

There are various methods to modify headers. You can modify headers by using browser extensions or proxy apps (such as Charles and Proxyman) that intercept the request and let you modify the response by including the headers.

But first, let’s start at the beginning.

What Are HTTP(s) Headers?

HTTP(s) Headers are key-value pairs that can be used by the client or server to pass additional information along with an HTTP(s) request or response. They hold additional information about the data being sent. An HTTP(s) header consists of a case-insensitive name followed by a colon (:), then by its value. Field names are case insensitive but field values are case sensitive. A header can have multiple values which are separated by commas.

Modifying Headers: How Can This Be Helpful?

I was working on an application that opened the provided webpage and then give the user an option to modify elements, add events, add analytics, and so on. without any need to code. This was being done by loading the page in iframe and giving various options to the user on top of it. I tried with loads of websites to see how they behave in iframe. I observed that most of the websites don’t work in iframe due to x-frame-options and content-security-policy headers.

Almost all websites have a header X-frame-options set to deny or sameorigin due to which the browser does not allow to load the webpage in an iframe or doesn’t when any cross-origin request tries to load it in an iframe. Also, the content-security-policy header has frame-ancestors directive which prevents this.

It was very important to load the page in iframe, I was wandering around the internet to find a way to load it. It was evident that I needed to override the X-frame-options header to allowall or remove it altogether. That was when I stumbled upon Requestly extension which gave me the feature to modify the X-frame-options header by matching the page URL and hence allowing me to override the X-frame-options header when debugging.

That was when I first got to witness the power of network headers. They carry data about the data being transferred. The ability to modify the headers of traffic that pass through your browser is a great tool to have. Besides overriding X-frame-options, you can delete headers to minimize online tracking, override content-security-policy header, test sites in production, and so on.

While testing web applications, modifying headers provides a great hack:

  • to test the guest mode of an application;
  • can set cookies using headers;
  • to test certain parts of an application that are by default disabled and can be enabled by passing a custom request header;
  • to test different test cases associated with headers;
  • to bypass authentication flow in your application by passing the authorization header.

When I got to know about the automated testing of web apps, it occurred to me that modifying headers should be a feature there due to its immense applicability in web app testing. Therefore I decided to write this piece to throw some light on the ways to modify headers in automated testing.

Selenium

Selenium is widely used as a test automation framework for end-to-end testing of web applications. It was developed in 2004. Initially, Selenium IDE was being used but it only supported firefox then Selenium RC was developed to enable cross-browser testing. Now the Selenium WebDriver is being used as it provides support for the mobile experience and dynamic websites. It mimics a real user interacting with the webpage.

Advantages Of Using Selenium WebDriver

  • Selenium WebDriver is open source;
  • It offers bindings for every major programming language;
  • Works across multiple OS. Test written in Windows would easily work on Mac;
  • Keyboard and cursor simulation are supported;
  • Add-ons can be installed.

Limitations Of Selenium WebDriver

  • No support to modify headers;
  • No support to add request parameters;
  • Cannot block a request.

As discussed, the ability to modify headers helps tremendously in testing applications but the Selenium WebDriver doesn’t support it, and they don’t plan to include it lately.

This article focuses on various approaches to modify headers in a Selenium automation setup.

Approach 1: Selenium Wire (Python)

Selenium Wire extends Selenium Python bindings to give you access to the underlying requests made by the browser. You author your code in the same way as you do with Selenium, but you get extra APIs for inspecting requests and responses and making changes to them on the fly.

It allows modifying requests and responses on the go using interceptors. It can also block requests, mock responses, add request parameters in the URL.

Usage

Adding Request Headers

# interceptor function intercepts the network request
# If one arg is provided, requests are intercepted
# and can be modified
def interceptor(request):
    request.headers['New-Header'] = 'Some Value'
# setting the driver's request_interceptor to equal
# the customised interceptor
driver.request_interceptor = interceptor
driver.get(<URL_where_to_modify_the_header>)

# All requests will now contain New-Header

Duplicate header names are permitted in an HTTP request, so before setting the replacement header you must first delete the existing header using del otherwise two headers of the same name will exist.

Adding Response Headers

# A response interceptor takes two args which
# then allows to tinker with the response
def interceptor(request, response):  
    if request.url == 'https://server.com/some/path':
        response.headers['New-Header'] = 'Some Value'
driver.response_interceptor = interceptor
driver.get(<URL_where_to_modify_the_header)

# Responses from https://server.com/some/path will now contain 
# the New-Header

A response interceptor should accept two arguments, one for the originating request and one for the response.

Limitations

  • This is only available as a Python module.
  • It does not support other languages.
Approach 2: Loading Browser Extension In Selenium Which Can Modify Headers

There are tools like Requestly which is a one-stop tool to debug & modify network requests. Requestly allows users to Modify Headers, Redirect URLs, Switch hosts, Mock API response, Delay network requests, Insert custom scripts, etc. It provides ready to go npm package which is a wrapper around the extension enabling the use of extension in Selenium. It supports Chrome, Firefox and Edge.

Using Requestly In Selenium

Requestly allows you to do a lot more things other than just modifying headers. All these things can be set up within a web interface and the shared list can be loaded into the application which allows the user’s flexibility to edit the rules easily in a web application.

To Install: npm i @requestly/selenium

Usage

A Modify Headers Rule can be created at app.requestly.io/rules after installing the extension.

After creating the URL, click on the Share button to generate a link for the URL.

The URL for the above created sharedList is here.

This URL is a Requestly rule which adds Access-Control-Allow-Origin header to all requests.

This rule can be used in the Selenium WebDriver using the sharedList URL which is described below:

require("chromedriver");
const { Builder } = require("selenium-webdriver");
const chrome = require("selenium-webdriver/chrome");
const { getRequestlyExtension, importRequestlySharedList } = require("@requestly/selenium");

const options = new chrome.Options().addExtensions(getRequestlyExtension("chrome"));
const driver = new Builder()
    .forBrowser("chrome")
    .setChromeOptions(options)
    .build();

// Imports Rules in Selenium using Requestly sharedList feature
// importRequestlySharedList(driver, <sharedList_URL>);

importRequestlySharedList(driver, 'https://app.requestly.io/rules/#sharedList/1626984924247-Adding-Headers-Example');

More information can be found here.

Limitations

  • It offers an npm package limiting the module to JavaScript only.
  • Shared Lists have to be created manually to use the rules in Selenium, hence the rules cannot be controlled through the code written for the Selenium automation test.
Approach 3: Using Puppeteer

Puppeteer is a Node library developed by Google which provides a high-level API to control headless Chrome or Chromium over the DevTools Protocol. It can also be configured to use full (non-headless) Chrome or Chromium.

When talking about browser automation setup, Selenium automatically comes to the mind but since the advent of Puppeteer it is widely being used for web scraping. It offers more control over chrome than Selenium probably due to google’s support to it. Also due to the same reason, it rules out the need for an external driver to run the browser.

Usage

const puppeteer = require('puppeteer');

(async () => {
    const browser = await puppeteer.launch();
    const page = await browser.newPage();
    await page.goto('<https://example.com>');
    await page.screenshot({ path: 'example.png' });
    await browser.close();
})();

Modifying Headers

The page.setExtraHTTPHeaders(headers) method can be used to set headers.

It can also modify and remove existing headers. Once requests are intercepted using a combination of page.setRequestInterception(true) and page.on().

await page.setRequestInterception(true);
page.on('request', request => {
// Override headers
    const headers = Object.assign({}, request.headers(), {
    foo: 'bar', // set "foo" header
    origin: undefined, // remove "origin" header
});

request.continue({headers});

});

Code source

Limitations

  • Puppeteer is limited to chrome for now. It cannot be used for cross-browser testing.
  • It has a smaller community compared to Selenium. There seems to be more support for Selenium in the community.
  • It only supports JavaScript.
Conclusion

Modifying network headers happens to be a very powerful tool in a testing environment. There’s a lot more to it than what can be covered in this article. I have tried to cover some of the simplest methods to modify headers in UI Automation Testing.

Every method has some advantages based on the use case and language you use. Here are some of the preferences:

  • If you want to use Selenium in Python, prefer Selenium-Wire as it provided a lot of features on top of Selenium-Webdriver.
  • If you want to test on only chrome, prefer puppeteer due to its google support and out-of-the-box support for all features including modifying headers.
  • If you work with Selenium and want to do cross-browser testing, prefer adding extensions to emulate the testing in Selenium-Webdriver. If your use-case requires you to inject scripts or redirect network resources in runtime (in addition to modifying headers), then Requestly is an ideal choice.

Hope this article gives you insight on modifying headers in an automated web application testing setup.

Further Resources