LambdaTest https://www.lambdatest.com/blog Learn everything about cross browser testing, selenium automation testing, along with latest and greatest on web development technology on at LambdaTest blog. Mon, 11 Dec 2023 10:39:21 +0000 en-US hourly 1 https://wordpress.org/?v=5.2.15 How Low Code Platforms Drive Digital Transformation Through Test Automation https://www.lambdatest.com/blog/role-of-no-code-low-code-testing-platforms/ Mon, 11 Dec 2023 10:29:01 +0000 https://www.lambdatest.com/blog/?p=62579 Continue reading How Low Code Platforms Drive Digital Transformation Through Test Automation ]]>

With No-Code/Low-Code application development and testing platforms, anyone from business users to experienced developers can create and test tools to help transform the business. This new technology is enabling change at a revolutionary pace and empowering businesses to stay in-step with ever-changing customer expectations.

The benefits of digital transformation are compelling. But it also creates challenges for software QA teams who have to ensure that No-Code/Low Code applications are secure, reliable and can scale to meet the business’ requirements.

No Code/Low Code software testing platforms help IT create a QA environment and address staffing and talent development issues.

What is “No-Code/Low-Code”?

What makes a development or testing platform either “No-Code” or “Low-Code”?

No-Code and Low-Code tools often provide visual user interfaces and pre-built components, making app development accessible to a broader audience. More experienced developers can rapidly accelerate development by hosting often-reused components in an easily accessible interface, such as drag-and-drop. No-Code or Low-Code platforms often are delivered via Cloud and Web delivery infrastructure, but you can host these tools locally on your network.

The adoption of No Code/Low Code platforms is on the rise. By 2025, Gartner predicts that 70% of new apps will be developed through No Code/Low Code tools. That’s a dramatic increase from less than 25 percent just three years ago. So QA teams must adapt their processes to align with No Code/Low Code development.

Typical use cases for No-Code/Low-Code development include:

  • Rapid Application Prototyping: Proof-of-concept can be spun up in hours instead of weeks.
  • Workflow Automation: Repetitive business processes can be streamlined with simple drag-and-drop.
  • Data Integration: Business users can employ Zapier and other integration services to share and transform data between applications.
  • Custom Reporting Dashboards: Tailor data visualization at the user level.
  • Web Forms and Surveys: Web forms and surveys can be customized by any team member.
  • Content Management: “Page builder” tools in CMSs, such as WordPress, can create custom landing pages.
  • E-commerce Solutions: Configure shopping carts for optimum upsell and resell opportunities,
  • Customer Relationship Management (CRM): Unlimited workflows and reporting dashboards for unique business requirements.

Clearly, companies can leverage No-Code/Low-Code to keep up with the explosive pace of digital transformation. These benefits come with testing and quality assurance challenges.

Why is Testing Always Critical?

The absence of traditional coding doesn’t eliminate the need for testing. Applications, regardless of how they are built, can still have vulnerabilities, including:

  • Data Integrity Issues: Faulty processing can lead to critical errors and even data breaches.
  • Performance Problems: Slow response times from optimized applications can negatively impact user experience.
  • Security Vulnerabilities: Weak security can expose sensitive data to cyber attack.

Rapid development of apps by multiple stakeholders can also create additional risks specific, such as:

  • Insecure Code: Inexperienced developers may introduce vulnerabilities.
  • Security and Compliance: Lack of oversight can lead to non-compliance with industry regulations.
  • Low Visibility into Underlying Code: No-Code/Low-Code apps can be black boxes.
  • Limited Scalability and Performance: Without proper testing, applications may not scale as needed without performance bottlenecks. This is a notable concern with third-party drag-and-drop integration tools.

Benefits of Comprehensive Application Testing

As you might imagine, the risks of relinquishing some control over the underlying code of applications, as well as opening the door to business users to create their own apps as needed, creates an understandable level of stress for QA teams.

Fortunately, testing automation platforms are keeping pace with digital transformation, aligning with the broader advantages of the No-Code/Low-Code approach. No-Code/Low-Code automated testing platforms create the needed scale to cost-effectively test applications – regardless of how they are developed – at any stage of emerging continuous development processes.

No-Code/Low-Code testing automation platforms help QA teams meet these challenges created by the ongoing digital transformation.

  • Talent Shortage: By empowering business users to test, you alleviate the burden on QA teams and address the shortage of specialized testing talent.
  • Employee Pushback: When employees are involved in testing, they have a better understanding of application functionality, reducing resistance to technology changes.
  • Limited Funds and Unclear Budgets: Comprehensive testing can lead to cost savings by preventing costly post-release fixes.
  • Lack of Business Agility: Robust testing ensures that applications perform as expected, supporting business agility.
  • Fragmented View of Software Quality Assurance: By compiling all testing data – regardless of which department is executing the tests – into a single platform, QA professionals can run comprehensive reports and diagnostics on the overall health of the business’s data and compliance ecosystem.
  • Leveraging AI and other Emerging Technology: Incorporating an ever-evolving automation platform can ensure that AI and machine learning are smartly applied for test optimization and predictive risk assessment, while avoiding a lot of the hype surrounding AI as “the solution to everything.” Quality Assurance will always rely on a team of professionals with the best tools at their disposal.

No-Code and Low-Code application development platforms are driving digital transformation. However, the incredible speed at which applications are created through these platforms necessitates an equally agile and comprehensive testing approach. Organizations that embrace No Code/Low Code testing platforms will not only keep pace with digital transformation, but also instill confidence in the applications the business relies on and address staffing and talent development issues within their QA and testing teams.

]]>
November’23 Updates: The All-New UnderPass Desktop Application, Auto Muting With HyperExecute, and More! https://www.lambdatest.com/blog/november-2023-updates/ Fri, 08 Dec 2023 15:28:37 +0000 https://www.lambdatest.com/blog/?p=62550 Continue reading November’23 Updates: The All-New UnderPass Desktop Application, Auto Muting With HyperExecute, and More! ]]>

It’s time for the product updates for November. The latest updates consist of some major and minor improvements. It includes an enhanced version of our UnderPass desktop application, support for configuring custom viewports for Storybook visual testing, an auto muting feature in HyperExecute, and others. So, let’s have a look at what these updates are.

To get a video walkthrough of November product updates, watch this video.


The Revamped UnderPass Tunnel Application

In 2020, we rolled out an UnderPass desktop application that lets you test your locally or privately hosted websites and web applications on a secure and reliable cloud platform. It automatically launches a LambdaTest Tunnel for you and eliminates the hassle of triggering it from the command line.

This time, to further optimize your web experience of testing local pages, we have revamped the UnderPass desktop application. With this, you can test local websites by leveraging out-of-the-box features like multiple login options, log sharing, and more.


Revamped UnderPass Tunnel Application

Let’s dig down on the features the new UnderPass has to offer:

  • Enhanced User Interface: We’ve given our UI a makeover for a more intuitive and user-friendly experience.
  • Various Login Options: You can now sign in using your email and password or opt for the convenience of Google, GitHub, or SSO authentication.
  • Effortless Tunnel Management: You can efficiently manage multiple tunnels simultaneously.
  • Tailored Configuration: Whether you prefer basic or complex setups, we offer advanced tunneling options to cater to your needs.
  • Simplified Log Sharing: Debugging websites is even easier with our hassle-free copy log feature.

Here is the documentation to get started with local testing using UnderPass.

Meanwhile, you can also check out the tutorial below to kick-start your local testing with the new UnderPass desktop application.

Custom Viewport Configuration for Storybook Visual Testing

You can now easily see how your UI components look on different device screens such as mobile or tablet. And you can do this by setting up your custom viewport configurations. This new feature by LambdaTest Smart UI builds on Storybook’s viewport toolbar that allows you to view your stories across various devices and in different orientations, whether it’s portrait or landscape.

Setting up custom viewports for visual regression testing using Storybook can be done by updating the .smartui.json file within your project repository.

{
...
...
"customViewports": [
      {
        "stories": [
          "<name of the stories/components>"
        ],
        "styles": {
          "width": 320, //Small mobile view
          "height": 568
        }
      },
      {
        "stories": [
          "<name of the stories/components>"
        ],
        "styles": {
          "width": 834, //Tablet view
          "height": 1112
        }
      }
      // Additional custom viewport configurations can be added here
]
...
...
}

We also have a support doc in place on how to configure custom viewport for Storybook visual testing.

Auto Muting Feature in HyperExecute

HyperExecute is now live with another feature called Auto Muting. It allows you to temporarily disable the execution of specific test cases. This feature becomes particularly useful when you deal with tests that consistently fail or are irrelevant to the current testing focus.

By using Auto Muting, you can significantly enhance the efficiency and effectiveness of your testing process. The primary advantage of Auto Muting is that it enables you to skip consistently failing test cases. This means you can save valuable time and resources by not running tests that are known to fail consistently or have no relevance to the current testing scope.

Auto Muting Feature in HyperExecute

For example, below is a triggered HyperExecute job having a recurring issue with a specific test case that consistently fails. To fix this issue, you can enable the Auto Muting feature that automatically mutes the test case that fails a predefined consecutive number of times.

scenarios

Refer to our guide to get started with Auto Muting in HyperExecute.

Support for Sub-Organizations in Test Analytics

In our latest update for test analytics, users of parent organization accounts can now effortlessly monitor the real-time browser session usage of all their sub-organizations through a single view. With this support, they can observe the resource utilization of individual sub-organizations, which enables them to take a strategic and informed approach to resource planning.

Here are a few benefits:

  • Administrators gain the ability to track browser concurrency via a centralized dashboard, offering a comprehensive overview of resource usage across all sub-organizations.
  • Real-time insights enable immediate resource allocation modifications that ensure optimal performance and cost efficiency.
  • Detailed usage statistics provide parent organizations with the essential data for making informed decisions regarding future resource provisioning and capacity planning.
  • This feature provides a granular level of control to identify usage patterns and potential areas for improvement within sub-organizations.
Info Note

Test your websites and mobile apps on real devices. Try LambdaTest Today!

New Integrations

To streamline the testing process, we regularly ensure that our list of integrations remains current and compatible with your preferred tools.

Here are the latest LambdaTest integrations:

  • Integration with Gradle Plugin: Gradlе is a build automation tool for multi-languagе softwarе dеvеlopmеnt. It managеs thе еntirе dеvеlopmеnt lifе cyclе, еncompassing tasks likе compilation, packaging, tеsting, and dеploymеnt. With LambdaTest integration with Gradle Plugin for Espress automation testing, you can optimize your parallel testing on a real device cloud.
  • Buildkite Integration: LambdaTеst has rеcеntly intеgratеd with Buildkitе, a CI/CD platform, to еnhancе your go-to-markеt dеlivеry. Using this LambdaTest intеgration with Buildkite, you can perform automatеd tеsting using LambdaTеst onlinе Sеlеnium grid across 3000 rеal browsеrs and OSes while leveraging the CI/CD capabilities offered by Buildkite platform.
  • New Relic Integration: Nеw Rеlic is an obsеrvability platform for monitoring, diagnosing, and еnhancing your softwarе applications. It sеamlеssly gathеrs data from your applications, infrastructurе, and logs, dеlivеring valuablе insights into systеm pеrformancе and potential issues.
  • Thе intеgration of LambdaTеst with Nеw Rеlic lets you accеss LambdaTеst rеsults within a tailorеd Nеw Rеlic Dashboard. This provides an in-depth understanding of your automation scripts, еnabling you to еxpеditе product dеlivеry with uncompromisеd quality and spееd.

    It’s a Wrap!

    Stay tunеd as we have some more updatеs and improvеmеnts linеd up for Dеcеmbеr. To keep up with the latest product features, you can visit the LambdaTest Changelog. You can also request feature enhancements or suggest improvements to our product on the LambdaTest Community by heading to the LambdaTest Feature Requests category. Your input is valuable in helping us make our product even better.

    ]]> Webinar: End-to-End Test Automation with Provar [Experience (XP) Series] https://www.lambdatest.com/blog/end-to-end-test-automation-with-provar/ Fri, 08 Dec 2023 05:00:15 +0000 https://www.lambdatest.com/blog/?p=62526 Continue reading Webinar: End-to-End Test Automation with Provar [Experience (XP) Series] ]]>

    Test automation, particularly in end-to-end testing, has emerged as a cornerstone in the contemporary software testing landscape. In the early days, manual testing dominated the era, which consumed considerable time and resources.

    However, the need for a more efficient and scalable approach became evident as software systems grew in complexity and development cycles shortened. This led to the widespread adoption of test automation, enabling organizations to streamline their testing processes.

    As organizations strive for continuous delivery and deployment, the significance of end-to-end testing automation will intensify, ensuring that software products meet the highest quality and functionality standards in an increasingly competitive market.

    In this blog, we’ll dive deep into the intricacies of end-to-end test automation with Provar. Uncover the nuances and best practices that elevate your understanding of streamlined test automation processes.

    Dive into the world of end-to-end test automation by watching our LambdaTest Experience (XP) Series webinar to gain valuable insights and best practices in test automation. So, without further ado, let’s get started.

    About LambdaTest XP Series & Speaker

    LambdaTest Experience (XP) Series includes recorded webinars/podcasts and fireside chats featuring renowned industry experts and business leaders in the testing & QA ecosystem. In this episode of our XP series webinars, we’re excited to feature Zac Taylor, a seasoned Senior Solutions Engineer at Provar, bringing nearly seven years of invaluable experience to the discussion.

    About LambdaTest XP Series & Speaker

    Zac’s expertise extends beyond mere involvement in software development and quality teams; he is a dedicated solution provider with a deep commitment to assisting organizations, irrespective of size, in delivering exceptional software solutions.

    Getting to Know Provar: Testing Solution Pioneer

    Provar has led integrated quality management and Salesforce testing since 2014 and is well-known for being a Salesforce-first testing solution. Provar allows testers to reliably test full end-to-end scenarios that involve various web applications, APIs, databases, email services, and more. Provar has a global presence with offices in the US, UK, and India, and we have over 250 customers worldwide.

    Getting to Know Provar: Testing Solution Pioneer

    Beyond Browsing: Unpacking Salesforce Testing

    Zac mentioned some differences and nuances regarding Salesforce testing compared to generic solutions. With Salesforce testing, you can overcome different challenges that you face in day-to-day life. As some of you may or might not know, Salesforce releases roughly three times per year with multiple UI changes that can be wide-sweeping or may not get much information to deal with such changes.

    To combat this situation, Provar comes into play with its metadata-driven approach to Salesforce testing with a close relationship with Salesforce and its roadmap. So anytime Salesforce comes out with releases, Provar releases immediately that minimally impact any previous changes.

    Beyond Browsing: Unpacking Salesforce Testing

    Additionally, Salesforce has a very complicated and deep DOM with dynamically changing IDs that are changed every time the page is re-rendered. It has a lot of different page layouts based on the profiles and permission sets you’re testing against. This is quite a challenge, especially regarding generic testing solutions. So, leveraging Provar ensures you have a declarative approach to Salesforce testing and handling this complicated DOM.

    Salesforce also introduced the Shadow DOM. You might know that shadow root and Shadow DOM elements have been difficult to penetrate. To help facilitate testing in this environment, Provar has a proprietary locator technology called “NitroX” that allows users to penetrate these elements with standard XPath notation. Additionally, there are a lot of brittle and nested frames within Salesforce, which makes it very difficult to traverse.

    Mastering Rework: A Spiral of Improvement

    Zac emphasized that Salesforce has a complex ecosystem with many coding and testing platforms divided into production environments, developer environments, sandboxes, and other categories. Provar includes an elegant approach to override these within specific test cases to ensure no duplicate tests.

    Mastering Rework: A Spiral of Improvement

    It enables parameterizing the connection, pointing towards various environments and organizations, and using the same test cases. This way, you don’t have to mirror test cases for every node we’re testing against. Hence, these issues, nuances, and challenges lead to “The Rework Spiral”. So, the rework spiral is an example of a suite of automated test cases.

    Essential Salesforce Testing Features

    Zac highlighted various features of Provar for Salesforce testing. Some are listed here:

    • Ability to handle multi-factor authentication (MFA) and single sign-on support
    • Allows seamless environment overrides and switching
    • Allows auto-navigation for apps and different tabs
    • Allows Integration testing
    • Provides APEX commands and SOQL support
    • It allows you to perform email testing as well.

    Essential Salesforce Testing Features

    Provar Demo: In-Depth Exploration

    Zac showcased Provar’s demonstration with the following steps:

    Step 1: Set up and edit connection details

    Set up and edit connection details

    As for Salesforce, there are options for communities, portals, and normal connections. It also offers Auth-based support along with MFA and SSO. You just need to populate the username and password. You’ll notice that some environments will override the ones specified here.

    Step 2: Create a New Provar Test Case

    Create a New Provar Test Case

    Let’s start with building a simple test case here. Click on this New Test button. Then, choose a test folder name and the application or connection specified for the demo org. Finally, you need to select a Salesforce application to load into. These will be specific to your org and user profile. Once you have selected the application, click ‘Finish’.

    Step 3: Add New Contact information

    Add New Contact information

    Step 4: Login to your Salesforce account to get started.

    Login to your Salesforce account to get started.

    Step 5: Run Test Builder, and you’ll be able to see your desired contact form.

    Run Test Builder, and you’ll be able to see your desired contact form.

    You can also perform email testing, as demonstrated. Email testing has come up quite a bit, especially for things like marketing campaigns, ensuring that those emails are hitting the appropriate recipients and subjects. So again, we can test that via the UI or the API.

    test that via the UI or the API.

    For more information, visit Provar’s support documentation.

    How Does LambdaTest Elevate Test Scalability Infrastructure?

    Zac mentioned that LambdaTest, an AI-powered test orchestration and execution platform, provides scalable infrastructure-less test execution on the cloud that helps facilitate clients/organizations from all walks of life and different points in their automation journey to get the most value.

    To get started with LambdaTest on Provar, go to our Test Settings tab and under our Browser Providers and just add a new browser provider. Then, choose the browser provider you want. For example, LambdaTest passes in the appropriate authentication methods. Then, you can do machine and browser-specific testing by choosing particular browser versions and screen resolutions for your mobile and web testing.

    How Does LambdaTest Elevate Test Scalability Infrastructure?

    You also add particular properties, additional information if anything is needed, and environment-specific variables. It’s very easy to set this up from within the application, get those test cases running on a regularly scheduled cadence, and be able to get the results.

    Interactive Q&A: Testing Insights

    Q: How can Provar enhance the field locator strategy and enable the framework to extend beyond Salesforce testing?

    Zac: Since our baseline was the page object model, many other automation testing frameworks have been used to extend, really leaning into our Nitro X and fact-based, component-driven framework. So, identifying specific components that aren’t tied to particular pages gives you a lot more versatility when testing, a lot less time having to map elements that you’ve already mapped on previous pages, and allows you to extend that framework significantly.

    Additionally, in fact, you can, you know, variablize and parameterize different inputs. The world is your Oyster, so to speak, regarding what we can do to extend NitroX.

    Q: How do you integrate Provar into different CI/CD pipelines with the help of version control?

    Zac: Provar has a direct integration with Git from our desktop client. So you can push, pull, commit, and collaborate as needed. We also have all of our test case files on your local machine. So, if you use another version control system outside of Git, we also fully support that.

    So once you have everything checked into a version control system for collaboration, Provar offers many options for continuous testing; no matter what your flavor of CI/CD is, Provar can enmesh itself in your day-to-day operations effectively. This is by no means a comprehensive list. These are just some of the larger players we’ve seen in the industry.

    Wrapping Up! I Hope You Enjoyed It!

    In conclusion, our exploration into the intricacies of end-to-end test automation with Provar underscores its indispensable role in the contemporary software testing landscape. As the software development ecosystem continues its dynamic evolution, incorporating robust testing methodologies, particularly those centered around end-to-end automation, remains integral to ensuring the delivery of high-caliber and reliable software solutions.

    Brace yourselves for the exciting episodes in the LambdaTest Experience (XP) Series webinars. Until we converge again for more revelations in the expansive universe of software testing, remember to stay curious and resilient and, above all, keep testing! Until next time, the journey persists, and we look forward to sharing more insights with you.

    #LambdaTestYourApps❤

    ]]>
    Gain Deeper Testing Insights Using LambdaTest and New Relic Integration https://www.lambdatest.com/blog/new-relic-integration/ Thu, 07 Dec 2023 15:51:31 +0000 https://www.lambdatest.com/blog/?p=62508 Continue reading Gain Deeper Testing Insights Using LambdaTest and New Relic Integration ]]>

    Delving into the landscape of application performance and monitoring is essential for any development endeavor, as it provides real-time insights, proactive monitoring, and a comprehensive approach to performance management. It also highlights the crucial role of analytics in shaping the future of software development and testing.

    New Relic stands out as the go-to solution for organizations aiming to elevate their testing requirements. It not only serves as a repository for test cases and results but also offers insightful analytics and reporting capabilities. It also gives you a better understanding of your automation scripts so you can quickly generate high-quality products.

    The integration of LambdaTest with New Relic enables users to incorporate their test results into a personalized New Relic dashboard. It gives teams insights into how their system is doing and where potential problems lie by assisting in collecting data from all of your apps, infrastructure, and logs.

    If you want to try this integration, please refer to our detailed documentation on LambdaTest integration with New Relic.

    new relic integration

    What is New Relic?

    New Relic emerges as a comprehensive observability platform, offering invaluable support in monitoring, troubleshooting, and optimizing your software systems. This platform seamlessly gathers data from diverse applications, infrastructure, and logs, presenting a holistic perspective on your system’s performance.

    new relic

    Here are some of the use cases of New Relic that make it stand out:

    • Performance Insights: New Relic integration provides performance monitoring, offering deep insights into the application’s performance metrics for optimized user experiences.
    • Efficient Issue Resolution: Leveraging New Relic enables swift identification and resolution, reducing downtime and enhancing overall system reliability.
    • Seamless CI/CD Integration: New Relic’s integration with LambdaTest facilitates smooth collaboration within CI/CD pipelines, allowing teams to incorporate test results into their development workflows seamlessly.
    Info Note

    Automate your test scripts to ship quality products at light speed. Try LambdaTest Today!

    LambdaTest Integration with New Relic

    With LambdaTest and New Relic integration, you can get a holistic overview of your testing behavior by pushing your test data from the LambdaTest platform to New Relic dashboards. This will give you a comprehensive insight into how your testing team runs tests and how they function across different browsers and operating systems.

    You can view your passed and failed tests against the different browsers and operating systems. The dashboard consists of LambdaTest – Test Overview and LambdaTest – Test Error Overview.

    • Test Overview – Test Overview provides insights into your testing trends, including the total number of test runs, tests completed, and tests passed. It also delves into specifics, such as the distribution of test runs across browsers and devices, providing an understanding of testing patterns. The image below shows that the number of Test Runs in the past week was 42.9k, with 4.72k Tests Completed and 4.77k Tests Passed. This detailed information provides a quick and intuitive overview of your testing metrics.
    • Test Overview

    • Test Error Overview – It dissects error trends, providing an in-depth analysis of types of errors, frequency, and their impact on different testing environments. This level of specificity, covering aspects like idle timeout, queue timeout, and lambda errors, enables developers to pinpoint and address issues effectively. The below image shows detailed information on the number of test errors in the past week, with Idle Timeout at 4.82k, Queue Timeout at 4.69k, and Lambda Error at 4.78k. It enables you to understand your testing error landscape.
    • Test Error Overview

      Conclusion

      In summary, the seamless integration of New Relic and LambdaTest significantly enhances the software development life cycle. With LambdaTest’s extensive cross browser testing capabilities and New Relic’s performance monitoring and diagnostic tools, developers now have the potential to streamline their workflows. This integration allows teams to swiftly identify and address software issues, ensuring a more efficient resolution process.

      Don’t hesitate to try this integration, and let us know what you think about the LambdaTest Community. If you have questions or need help, contact us through our chat portal or support@lambdatest.com.

      Happy testing! 😊

      ]]> Cracking the Code of CSS Specificity: A Developer’s Toolkit https://www.lambdatest.com/blog/css-specificity/ Tue, 05 Dec 2023 09:58:54 +0000 https://www.lambdatest.com/blog/?p=62376 Continue reading Cracking the Code of CSS Specificity: A Developer’s Toolkit ]]>

      Cascading Style Sheets (CSS) is the backbone behind every pixel-perfect layout, beautifully styled button, and color scheme. It is more like the system that shapes the web designs we navigate daily. In CSS, there’s a hidden factor that has confused even the most seasoned developer—it’s known as CSS specificity.

      Now, imagine you’re building your own website. You pick the right fonts, line everything up perfectly, and choose colors that fit just right. It all looks great, but then, out of nowhere, things on your webpage ignore your design choices. You wonder, why aren’t the styles I set working?

      And the reason is CSS specificity. It decides which style choices are most important on your webpage. If you’ve ever found yourself frustrated by unexpected styling conflicts, inconsistent application of your styles, or felt like your CSS is missing important pieces, then this CSS tutorial will come in handy.

      We will discuss CSS specificity in depth, from the fundamental principles to the more advanced ones, using real-world applications to tackle them.

      What is CSS Specificity?

      CSS specificity is the concept used to determine which CSS rules apply to a specific HTML element whenever there are conflicting styles. It is a way to decide which style should take precedence when multiple styles or rules target a particular element.

      It’s based on a hierarchy: IDs override classes and element selectors, which, in turn, override basic element styles. Inline styles hold the highest precedence. This concept helps browsers decide which style to apply. Understanding specificity ensures predictable styling and aids in writing efficient, maintainable code. Developers must prevent unintended style overrides and ensure desired styles are consistently applied.

      The Importance of CSS Specificity

      Precision is paramount in modern web development. Every element, from the text and images to the layout and colors, is crucial in creating a seamless user experience. These elements have a general or specific CSS style to change their appearance on a webpage. This is done either to create uniqueness or just to change the overall aesthetic of the element or the web page at large.

      Here are some reasons why CSS specificity matters for developers:

      Resolving Styling Conflicts
      In web development, it’s common to have multiple CSS rules targeting the same HTML element. These rules may come from different sources, such as external stylesheets, internal styles, or inline styles. When conflicts arise between these rules, CSS specificity determines which styles take precedence.

      Avoiding Unintended Consequences
      CSS specificity is also critical in preventing unintended results in your styles. With a clear grasp of specificity, you can carefully manage your styles to ensure a consistent and delightful experience on your website, avoiding unintentional changes that could lead to unexpected results. Also, you gain control over which styles are applied and can create a predictable and maintainable codebase.

      Enhancing Code Maintainability
      In large-scale web development projects, maintaining code can be a daunting task. CSS specificity helps developers write cleaner and more maintainable code by reducing the need for overly specific selectors and convoluted workarounds.

      Boosting development Efficiency
      Efficiency is the cornerstone of effective web development. Developers proficient in CSS specificity can work more efficiently by quickly identifying and resolving styling issues. This proficiency leads to faster development cycles and allows developers to focus on creating exceptional user experiences.

      Role of Selectors in CSS Specificity

      When it comes to specificity, CSS selectors are the building blocks. CSS selectors are patterns or rules that define which HTML elements should receive specific styling rules or properties. CSS selectors help you control the presentation and layout of your web content, as they are in charge of choosing which element gets which style.

      Selectors consist of three main parts, and they include:

      • Element: This is the HTML element you want to style; it could be a div, p, h1, or a.
      • ID: It is an optional unique identifier for an HTML element, denoted by a hash symbol (#). IDs should be unique within a page.
      • Class: A class selector, denoted by (.), allows you to target multiple elements with the same class attribute. Classes can be applied to multiple elements on a page.

      To demonstrate the use of the basic CSS selectors, let’s consider this example.

      <!DOCTYPE html>
      <html lang="en">
      <head>
      <meta charset="UTF-8" />
      <meta name="viewport" content="width=device-width, initial-scale=1.0" />
      <title>Document</title>
      </head>
      <style>
      * {
      margin: 0;
      padding: 0;
      }
      
      
      #card {
      max-width: 800px;
      width: 80vw;
      margin: 3rem auto;
      padding: 2rem;
      background-color: rgb(220, 235, 245);
      }
      
      
      p {
      font-size: 1.2rem;
      }
      h3 {
      padding-bottom: 1rem;
      text-align: center;
      font-size: 1.5rem;
      }
      .readmore {
      padding: 10px;
      font-size: 1rem;
      border: 2px solid rgb(20, 159, 171);
      margin-top: 1rem;
      }
      </style>
      <body>
      <div id="card">
      <h3>Run Automated Playwright Tests Online</h3>
      <p>
      Run your Playwright test scripts instantly on 50+ browser and OS
      combinations using the LambdaTest cloud. Execute Playwright testing in
      parallel and cut down your test execution time by multiple folds.
      </p>
      <button class="readmore">Read more</button>
      </div>
      </body>
      </html>

      In the code above, we used the three basic CSS selectors (tag, id, and class) to select and style HTML elements. This is a very basic example that shows how selection and styling work. We have some styles for the p tag, the h3 tag, the id of the card, and the class of readmore. These styles are general and will affect any HTML element.

      Here is the output of the above code.

      Values of CSS Specificity

      Screenshot taken from LambdaTest Browser Testing

      Values of CSS Specificity

      CSS specificity values are used by web browsers to decide which styles to apply when conflicts arise. In this section, we will be discussing how these values apply.

      There is a unique technique used in calculating CSS specificity. Specificity values are represented using a four-part notation, and the technique is often referred to as the Specificity Triplet. The four parts are:

      • Inline Styles: This sits at the highest level of CSS specificity. Styles that are applied to elements directly using the style attribute are inline styles, and regardless of how every class, ID, or tag is styled, they will always obey the styles set in the style attribute. Inline styles are represented as 1, 0, 0, 0.
      • ID Selectors: ID selectors are next when it comes to CSS specificity. IDs are not intended for reuse and, hence, have a high specificity. Each ID should be unique to a particular page. ID selectors are represented as 0,1,0,0. Always bear in mind that the more the ID selector, the higher the specificity.
      • Class and Attribute Selectors: Class and attribute selectors are on the same level of specificity. They are represented as 0, 0, 1, 0. They are used in multiples to increase their specificity.
      • Element Type Selectors: Elements are the lowest in terms of specificity. They are represented as 0, 0, 0, 1.

      Remember that this four-part notation can change depending on combining multiple selectors to target a specific element. For instance, if we had a rule with an ID selector and an element type selector, the specificity value would be 0, 1, 0, 1.

      Or if we have an ID selector and a class selector, the specificity value would be 0, 1, 1, 0.

      Cascade in

      The Cascade in CSS

      This fundamental concept in CSS determines how styles are applied to HTML elements when multiple conflicting rules target the same element.

      The cascade, often abbreviated as CSS, is a process that browsers use to decide which styles should be applied to an HTML element when there are conflicting rules. It follows a specific order of precedence to determine the final style for an element. This order consists of several levels:

      User Agent Stylesheets
      The lowest level of specificity is the default styling provided by the user agent (browser). Every browser has its own set of default styles for HTML elements. These styles serve as a baseline and can be overridden by more specific rules.

      Let’s consider this code to see the user agent stylesheet in action.

      <!DOCTYPE html>
      <html lang="en">
      <head> </head>
      <body>
      <h1>LambdaTest</h1>
      <p>Next-Generation Mobile Apps and Cross Browser Testing Cloud</p>
      </body>
      </html>

      In the code above, we have an h1 and a p tag with no CSS attached. Here is the result of the code.

      developed

      Screenshot from LT Browser

      The above output is rendered on LT Browser. It is developed by LambdaTest for website testing and debugging. It enables you to perform responsive testing on your websites and various web applications across numerous device viewports, with the capability to test up to six viewports simultaneously. LT Browser offers over 53 viewports to test on, spanning mobile, tablet, and desktop devices.

      For continuous tutorials on automation testing, mobile app testing, and more, subscribe to our LambdaTest YouTube Channel.

      From the code output on LT Browser, we can see that even without a CSS code, the user agent stylesheet kicks in, giving the design a bit of the default style. You can see the margin around the elements and the increased font-size and font-weight of the h1 tag. All this is solely from the user agent stylesheet.

      Author Stylesheets
      These are the styles defined by the web developer in their CSS files. Author styles take precedence over user agent styles and are applied unless overridden by more specific rules. Let’s add some style to the previous code to override the user agent design.

      <!DOCTYPE html>
      <html lang="en">
      <head> </head>
      <style>
      h1{
      font-size: 1rem;
      font-weight: lighter;
      }
      </style>
      <body>
      <h1>LambdaTest</h1>
      <p>Next-Generation Mobile Apps and Cross Browser Testing Cloud</p>
      </body>
      </html>

      From the above code, we have set the h1 tag to have a font-size of 1rem and a font-weight of lighter. This is different from the user agent style, which sets the h1 font-weight to bold and the font-size to 2em. Here is the output:

      agent

      From the image above, you can see that the user agent stylesheet has some of its style stroked through; those are the styles replaced by the author’s style sheet.

      User Stylesheets

      Some users may apply their own custom styles to web pages using browser extensions or settings. These user-defined styles have higher specificity than author styles but lower specificity than inline styles.

      For instance, users can adjust their font-size to make text more readable, or as many users love dark mode, they may set their phones to dark mode, and the user stylesheet can implement the dark mode theme on certain websites that initially did not offer this feature.

      The primary purpose of the user style sheet is to provide a level of customization and accessibility to enhance the website’s usability for a range of users.

      Inline Styles

      Styles defined directly within an HTML element using the style attribute have the highest specificity. They override all other styles for that particular element. Let’s see this in action.

      attribute

      We added an inline style to the h1 element, giving it a font size of 3rem, despite previously setting the h1 to a font size of 1rem in the author stylesheet.

      See the output below. This is how it affects the code.

      Specificity

      As you can see, the inline style overrides both the author’s and the user agent’s styles.

      Specificity
      If there are multiple conflicting author stylesheets or inline styles, CSS specificity determines which style should be applied. Specificity is a calculated value based on the combination of selectors used in a CSS rule.

      If two rules have the same specificity, the rule that appears later in the stylesheet takes precedence and overrides the earlier rule. This concept is known as the “last rule wins.”
      Let’s consider this code to see the concept of last run wins in action.

      <!DOCTYPE html>
      <html lang="en">
      <head> </head>
      <style>
      h1{
      color: red;
      }
      h1{
      color: green;
      }
      </style>
      <body>
      <h1>LambdaTest</h1>
      <p>Next-Generation Mobile Apps and Cross Browser Testing Cloud</p>
      </body>
      </html>

      Browser Output

      overrides

      We can see that the h1 obeys the last rule, setting the color to green, which overrides the first h1 style. You can check out this Specificity Calculator by Keegan, which will further expand your knowledge on CSS specificity.

      Real-World Examples of CSS Specificity

      There are several common web design scenarios where CSS specificity plays a crucial role. In this section, we will be looking at some of these scenarios using a real-world design.

      Creating a Navigation Bar

      Let’s say you have a navigation bar on your website with buttons and links that you want to style differently. Buttons should have a different style than links.

      If you apply a broad selector like a for links and a button for buttons, you might run into specificity conflicts. Let’s discuss how to write more specific selectors to target each element appropriately.

      HTML:

      <!DOCTYPE html>
      <html lang="en">
      <head>
      <meta charset="UTF-8" />
      <meta name="viewport" content="width=device-width, initial-scale=1.0" />
      <title>Document</title>
      <link rel="stylesheet" href="./style.css" />
      </head>
      <body>
      <nav>
      <h3>
      <a href="https://www.lambdatest.com/"
      ><img
      class="logo"
      src="https://www.lambdatest.com/resources/images/logos/logo.svg"
      alt="logo"
      /></a>
      </h3>
      <ul class="nav-items">
      <li><a href="https://www.lambdatest.com/feature">Platform</a></li>
      <li><a href="https://www.lambdatest.com/enterprise">Enterprise</a></li>
      <li><a href="https://www.lambdatest.com/blog/">Resources</a></li>
      <li>
      <a
      href="https://www.lambdatest.com/support/docs/getting-started-with-lambdatest-automation/"
      >Developers</a
      >
      </li>
      <li><a href="https://www.lambdatest.com/pricing">Pricing</a></li>
      
      
      <li>
      <a
      class="upgrade-btn"
      href="https://billing.lambdatest.com/billing/plans"
      >Upgrade</a
      >
      </li>
      </ul>
      <img
      class="hamburger"
      src="https://www.lambdatest.com/resources/images/icons/toggle_menu.svg"
      alt=""
      />
      </nav>
      </body>
      </html>

      As seen above, we have the HTML of the design, which consists of six navigation links, one of which we will be converting to a button using the class name upgrade-btn for CSS specificity.

      CSS:

      @import url("https://fonts.googleapis.com/css2?family=Nunito:wght@400;700&display=swap");
      
      
      * {
      margin: 0;
      padding: 0;
      }
      body {
      background-color: #ffffff;
      font-family: "Nunito", sans-serif;
      }
      
      
      /* Nav bar */
      
      
      nav img {
      width: 200px;
      }
      .nav-items {
      list-style: none;
      gap: 2rem;
      display: flex;
      align-items: center;
      }
      nav a:hover {
      color: #56bbc6;
      }
      nav {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 1rem;
      font-size: 1.2rem;
      background-color: white;
      box-shadow: 0px 0px 25px #888888;
      position: relative;
      }
      nav a {
      color: #000000;
      text-decoration: none;
      }
      .hamburger {
      display: none;
      }
      
      
      @media screen and (max-width: 952px) {
      .hamburger {
      display: block;
      width: 30px;
      }
      .nav-items {
      display: none;
      }
      }

      Here is the result of the design with the CSS in place.

      simple nav bar

      Design on an iPad Pro (Screenshot from the LT Browser)

      Just a simple nav bar, but we can change the appearance of the upgrade link using CSS specificity to target the nav link with the exact class of upgrade-btn.

      nav .upgrade-btn {
      background: linear-gradient(90deg, #3532ec, #800080);
      color: white;
      border: none;
      border-radius: 5px;
      padding: 10px 20px;
      }
      nav .upgrade-btn:hover {
      background: linear-gradient(90deg, #211f98, #5b075b);
      color: white;
      }

      Here is the output we get:

      output

      As seen, despite the style given to the nav links, CSS specificity made styling the upgrade button differently possible. As you can see, although they are all nav links, the upgrade button is styled differently.

      See the Pen
      Untitled
      by Clinton Joy (@Cejay101)
      on CodePen.

      Creating a Detail Page

      Browsers often have default styles for various HTML elements. You’ll need to override these styles to create a consistent look and feel for your website. With this example, we will see how CSS specificity comes into play when trying to override default styles and how using specific selectors can ensure your styles are applied.

      HTML:

      <!DOCTYPE html>
      <html lang="en">
      <head>
      <meta charset="UTF-8" />
      <meta name="viewport" content="width=device-width, initial-scale=1.0" />
      <title>Document</title>
      <link rel="stylesheet" href="./style.css" />
      </head>
      <body>
      <div class="lamdatest-info">
      <h3>With your new LambdaTest Account, you get:</h3>
      <div class="offer">
      <p>&check;</p>
      <div>
      <h4>3000+ Browsers, OS, & Real Devices</h4>
      <p>
      Run manual and automated tests of web and mobile apps across 3000+
      different browsers, real devices, and OS environments.
      </p>
      </div>
      </div>
      <div class="offer">
      <p>&check;</p>
      <div>
      <h4>70% Faster Test Execution</h4>
      <p>
      LambdaTest's HyperExecute is up to 70% faster than any traditional
      cloud-based Selenium Grid.
      </p>
      </div>
      </div>
      <div class="offer">
      <p>&check;</p>
      <div>
      <h4>3000+ Browsers, OS, & Real Devices</h4>
      <p>
      Test smarter with AI-powered test insights to help you anticipate
      and mitigate future issues before they take root.
      </p>
      </div>
      </div>
      <p>Trusted by 2 Million+ users globally at:</p>
      
      
      <div class="companies">
      <img
      src="https://accounts.lambdatest.com/icons/logos/logo1.svg"
      alt=""
      />
      <img
      src="https://accounts.lambdatest.com/icons/logos/logo2.svg"
      alt=""
      />
      <img
      src="https://accounts.lambdatest.com/icons/logos/logo3.svg"
      alt=""
      />
      <img
      src="https://accounts.lambdatest.com/icons/logos/logo4.svg"
      alt=""
      />
      <img
      src="https://accounts.lambdatest.com/icons/logos/logo5.svg"
      alt=""
      />
      </div>
      </div>
      </body>
      </html>

      There you have it, a basic design. Let’s see the output with just the User Agent style in place.

      user agent style

      Design result with the user agent style

      The user agent style provides a basic style to make your design look worth something; just in case the author stylesheet isn’t present, it directly affects your design if not reset.

      Before applying CSS, what I do most of the time is use a universal selector to reset some of the values that have been set by the user agent style.

      CSS:

      @import url("https://fonts.googleapis.com/css2?family=Nunito:wght@400;700&display=swap");
      
      
      /* Reset */
      * {
      margin: 0;
      padding: 0;
      background-color: #eef5fe;
      font-family: "Nunito", sans-serif;
      font-size: 1.2rem;
      }
      /* Info Style */
      .lamdatest-info {
      padding: 5rem;
      }
      .lamdatest-info h3 {
      font-size: 1.8rem;
      margin-bottom: 3rem;
      }
      .offer {
      display: flex;
      gap: 2rem;
      font-size: 1.5rem;
      margin-bottom: 3rem;
      }
      .lamdatest-info p {
      font-size: 1.2rem;
      margin-bottom: 2rem;
      }
      .companies img {
      width: 150px;
      }
      @media screen and (max-width: 502px) {
      .lamdatest-info {
      padding: 2rem 1rem;
      }
      .lamdatest-info h3 {
      font-size: 1.5rem;
      }
      .offer {
      gap: 1rem;
      font-size: 1.2rem;
      margin-bottom: 1rem;
      }
      .lamdatest-info p {
      font-size: 1rem;
      }
      .companies img {
      width: 100px;
      }
      }

      Browser Output:

      Up Form

      See the Pen
      Creating an information page
      by Clinton Joy (@Cejay101)
      on CodePen.

      A Sign-Up Form

      A sign-up form is another real-world example that can show how CSS specificity works. Specification can be used to style different input fields depending on their attributes and also different buttons depending on their class. Let’s consider this sign-up form design.

      HTML:

      <!DOCTYPE html>
      <html lang="en">
      <head>
      <meta charset="UTF-8" />
      <meta name="viewport" content="width=device-width, initial-scale=1.0" />
      <title>Document</title>
      <link rel="stylesheet" href="./style.css" />
      </head>
      <body>
      <div id="signup">
      <form id="form">
      <h2>Get started for free</h2>
      
      
      <div class="platforms">
      <a 
      href="https://accounts.google.com/o/oauth2/auth/oauthchooseaccount?client_id=706758774682-bjrjup3sgcqmqm1n4dq62pk72mvu8mhn.apps.googleusercontent.com&redirect_uri=https%3A%2F%2Faccounts.lambdatest.com%2Flogin%2Fgoogle%2Fcallback&scope=openid%20profile%20email&response_type=code&state=Kz4s0sM1i5Sa8v74vOBkteLIljh1cDn4YQpcvnSG&service=lso&o2v=1&theme=glif&flowName=GeneralOAuthFlow"
      class="platform-button"
      target="_blank"
      >
      <img
      src="https://raw.githubusercontent.com/Cejay101/LamdaTestImages/e863498d271de5c15fcce14ee75bad4aad55bc7d/images/google-color-svgrepo-com.svg"
      alt="google icon"
      />Sign up with Google</a
      >
      <a 
      href="https://github.com/login/oauth/authorize?client_id=b41139b9749e27d4487b&redirect_uri=https%3A%2F%2Faccounts.lambdatest.com%2Flogin%2Fgithub%2Fcallback%2Fv1&scope=user%3Aemail&response_type=code&state=mA5eziVBDxkmH1LwCJT9k1uID3mSVm3W8Jf8ohJo"
      class="platform-button"
      target="_blank"
      ><img
      src="https://raw.githubusercontent.com/Cejay101/LamdaTestImages/e863498d271de5c15fcce14ee75bad4aad55bc7d/images/github-142-svgrepo-com.svg"
      alt="Github icon"
      />Sign up with Github</a
      >
      </div>
      <div class="alt-text">
      <div></div>
      <p>OR SIGNUP VIA MAIL</p>
      <div></div>
      </div>
      <div class="field">
      <label for="name">Name </label>
      <input type="name" id="name" placeholder="e.g Clinton joy" />
      </div>
      
      
      <div class="field">
      <label for="email">Business Email</label>
      <input type="email" id="email" placeholder="e.g clinton@gmail.com" />
      </div>
      <div class="field">
      <label for="password">Desired Password</label>
      <input type="password" id="password" />
      </div>
      <div class="field">
      <input type="submit" id="submit" value="SIGN UP"/>
      </div>
      By clicking Sign Up or registering through a third party you accept
      the LambdaTest
      <a href="https://www.lambdatest.com/legal/terms-of-service"
      >Terms of Service </a
      >and acknowledge the
      <a href="https://www.lambdatest.com/legal/privacy">Privacy Policy</a>
      and
      <a href="https://www.lambdatest.com/legal/cookie">Cookie Policy</a>
      </p>
      <p class="signin-text">
      Already have an account?
      <a
      href="https://accounts.lambdatest.com/login?_gl=1*cz6gbh*_gcl_au*MTU1OTQzNjIzMS4xNjg5ODI4OTQ5"
      >Sign In</a
      >
      </p>
      </form>
      </div>
      </body>
      </html>

      CSS:

      @import url("https://fonts.googleapis.com/css2?family=Nunito:wght@400;700&display=swap");
      
      
      * {
      margin: 0;
      padding: 0;
      font-family: "Nunito", sans-serif;
      }
      a {
      text-decoration: none;
      }
      #form {
      padding: 3rem;
      max-width: 100vw;
      }
      img {
      width: 20px;
      }
      h2 {
      font-size: 3rem;
      color: rgb(36, 54, 96);
      text-align: center;
      }
      .platforms {
      display: flex;
      gap: 2rem;
      margin: 2rem;
      justify-content: center;
      }
      .platforms a {
      display: flex;
      gap: 5px;
      }
      .platform-button {
      background: none;
      color: rgb(36, 54, 96);
      border: 2px solid transparent;
      border-image: linear-gradient(90deg, #0000ff, #800080);
      border-image-slice: 1;
      border-image-width: 2px;
      border-image-outset: 0;
      border-radius: 0px;
      padding: 10px 20px;
      cursor: pointer;
      }
      .platform-button:hover {
      background: linear-gradient(90deg, #e2e2f1, #f1d3f1);
      }
      .alt-text {
      text-align: center;
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin: 2rem 0;
      }
      .alt-text div {
      background-color: rgba(198, 198, 198, 0.383);
      height: 2px;
      display: inline-table;
      width: 35%;
      }
      .field {
      margin-bottom: 1.5rem;
      position: relative;
      }
      label {
      font-size: 1rem;
      color: rgb(36, 54, 96);
      }
      input {
      display: block;
      padding: 1rem;
      width: 100%;
      font-family: "Nunito", sans-serif;
      box-sizing: border-box;
      font-size: 1rem;
      border: 1px solid rgb(188, 188, 188);
      border-radius: 5px;
      }
      input[type="submit"] {
      margin-bottom: 2rem;
      font-family: "Nunito", sans-serif;
      width: 100%;
      background: linear-gradient(90deg, #3532ec, #800080);
      color: white;
      border: none;
      border-radius: 5px;
      padding: 15px 20px;
      cursor: pointer;
      }
      input[type="submit"]:hover {
      background: linear-gradient(90deg, #1e1cbf, #5b0b5b);
      }
      input:hover {
      background-color: rgb(232, 236, 239);
      }
      .signin-text {
      margin-top: 4rem;
      text-align: center;
      }
      @media screen and (max-width: 502px) {
      #form h2 {
      font-size: 2rem;
      }
      .platforms {
      flex-direction: column;
      }
      .alt-text div {
      width: 20%;
      }
      }

      We started our CSS process with a crucial reset, incorporating the universal selector. This reset involved erasing default margins and padding while enforcing a universal Nunito font family across all elements on the page. This provides a clean slate for consistent styling.

      Even when dealing with input tags, we maintained the ability to target elements based on their distinct attribute values. Notably, by utilizing the type attribute with a value of submit, we were able to pinpoint and style the submit button distinctly. This works because attributes hold a higher specificity value than tag names. Consequently, the submit button adheres to the attribute-specific style rather than the generic element style.

      dealing with input tags

      See the Pen
      Untitled
      by Clinton Joy (@Cejay101)
      on CodePen.

      CSS Specificity Best Practices

      CSS specificity allows you to target and style elements precisely on your web page. On the other hand, it can lead to complex and hard-to-maintain code if not used wisely. To help you navigate this, here are some best practices for working with CSS specificity.

      Keep It Simple
      Whenever possible, favor simplicity over complexity. Avoid overly specific selectors and use the simplest selector that gets the job done. This makes your code more readable and maintainable.

      Use Classes and IDs Frugally
      While IDs have high specificity and can be helpful for unique elements, they should be used frugally because they can easily lead to specificity conflicts. Classes are generally preferred for styling elements.

      Avoid Inline Styles
      Inline styles (styles defined directly in HTML elements) have the highest specificity and can make your code hard to manage. Reserve them for exceptional cases where no other option is feasible.

      Use BEM (Block Element Modifier)
      BEM is a naming convention for CSS classes that helps avoid specificity issues. It promotes a clear and consistent naming structure for your CSS classes, making your code more predictable.

      Use Specificity as a Last Resort
      Only increase specificity when you have exhausted all other options. It’s usually better to refactor your HTML or CSS structure than to rely on high specificity.

      Combine Selectors Wisely
      Instead of creating extremely specific selectors, combine multiple classes or use descendant selectors to achieve the desired style. This maintains readability and lowers specificity.

      Organize Your CSS
      Keep your CSS organized and well-structured. Use comments and separate stylesheets for different components or sections of your website. This makes it easier to locate and manage styles.

      Avoid !important
      The !important declaration should be used infrequently. It can make it difficult to override styles later and should be reserved for critical cases where no other solution is possible.

      Regularly Review and Refactor
      As your project grows, periodically review your CSS to identify and eliminate unnecessary specificity. Refactoring your styles can help prevent specificity-related issues from piling up.

      Document Your Code
      Use comments to document the purpose of specific styles, especially when dealing with complex or high-specificity rules. This helps other developers (and your future self) understand the reasoning behind your choices.

      By following these best practices, you can strike a balance between precision and maintainability in your CSS code. Understanding specificity and applying these guidelines will contribute to cleaner, more efficient stylesheets and a smoother development process.

      Info Note

      Test your websites for CSS specificity on real devices. Try LambdaTest Today!

      Advanced CSS Specificity

      CSS specificity is more than just the use of regular selectors like IDs, classes, and tags; there is a whole lot attached to it, and in this section, we will see the use of some advanced CSS specificity techniques, like the use of selectors combination, pseudo-classes, inheritance, etc.

      Selector Combinators

      CSS provides several combinator operators that enable you to select elements based on their relationship to other elements in the document tree. These include:

      • Descendant Selector ( ): Selects an element that is a descendant of another element. For example, ul li selects all li elements that are descendants of ul elements.
      • Child Selector (>): Selects an element that is a direct child of another element. For example, ul > li selects all li elements that are immediate children of ul elements.
      • Adjacent Sibling Selector (+): Selects an element that is immediately preceded by a specified element. For example, h2 + p selects all p elements that directly follow an h2 element.
      • General Sibling Selector (~): Selects elements that are siblings of a specified element. For example, h2 ~ p selects all p elements that are siblings of an h2 element.

      Combining multiple selectors and combinator operators allows you to create complex selector combinations. For instance, div .class > p selects all p elements that are direct children of elements with class class, which themselves are descendants of div elements.

      When you combine selectors, the specificity of the resulting selector is determined by the cumulative specificity of its constituent parts. This means that if you have a selector like div .class > p, its specificity is influenced by the specificities of div, .class, and p.
      It’s important to note that the order of selectors can also affect specificity. In p.class, the class selector has a higher specificity than the type selector p.

      Combining selectors is especially useful when you need to target specific elements in complex layouts or when you want to apply styles to a specific subset of elements. While combining selectors can be powerful, using them judiciously is crucial to avoid unnecessarily high specificity, leading to unintended styling conflicts and making your code more challenging to maintain. Consider using class names and IDs to target elements where possible, as they have lower specificity and are easier to manage.

      Pseudo-classes

      Pseudo-classes are special keywords that allow you to select and style elements. They are very useful when it comes to CSS specificity, as they only target based on their state or position within the document.

      Here are some of the top pseudo-classes and how they work:

      :hover, :active, and :focus

      The :hover targets elements when a user hovers the mouse pointer over them. Whereas :active selects elements when a user actively clicks or interacts. On the other hand, the :focus targets elements when they receive keyboard or mouse focus (e.g., through the Tab key).

      :nth-child() and :nth-of-type()

      With these pseudo-classes, you can select a particular element to style based on its position in a parent container.

      The :nth-child() lets you select elements based on their position among all children of the same parent. While the :nth-of-type() selects elements based on their position among elements of the same type.

      :not()

      The :not() pseudo-class lets you exclude specific elements from being selected. You can use it to create exceptions in your CSS rules, preventing certain elements from receiving particular styles.

      :first-child and :last-child

      These pseudo-classes target the first and last child elements of a parent. It is useful for applying styles to elements at the beginning or end of a list or container. Pseudo-classes take the game of CSS specificity to another level and, thus, cannot be neglected.

      !important and Specificity

      !important is a CSS declaration that can be added to a property-value pair in a CSS rule. When !important is used, it gives that particular declaration the highest level of specificity, effectively overriding any conflicting styles, regardless of their specificity values. This can be good when used judiciously, but it can also lead to maintainability and debugging challenges if overused.

      Let’s consider this code to see how the !important declaration affects CSS specificity works.

      <!DOCTYPE html>
      <html>
      <head>
      <style>
      /* Base styles for headings */
      h1 {
      color: blue;
      }
      h2 {
      color: green !important;
      }
      .heading {
      color: red;
      }
      </style>
      </head>
      <body>
      <h1>This is a blue heading.</h1>
      <h2 class="heading">This is an important heading, colored green.</h2>
      </body>
      </html>

      In the code above we have the h1 and h2 tag both having different colors. The !important keyword is used in the h2 style rule, giving it the highest priority. Therefore, the color: red; rule from the .heading class is ruled out, and the h2 takes precedence over the base style for h2.

      Browser Output:

      h1 and h2 tag  both having different colors

      Screenshot taken from LambdaTest Browser Testing

      When !important is applied to a CSS declaration, it takes precedence over any other declaration for the same property, regardless of specificity. This means that even if a lower-specificity rule comes later in the stylesheet, the !important rule will win.

      !important is typically reserved for exceptional cases where you need to forcefully override a style, such as when working with third-party libraries or dealing with browser-specific issues.
      Common use cases include changing styles dynamically in JavaScript or addressing critical accessibility concerns.

      One of the biggest pitfalls of !important is its potential for abuse. Overusing !important can lead to poor predictability in your stylesheets, challenging debugging and maintaining your code. It’s recommended to use !important sparingly and only when other methods of achieving the desired styling effect are not feasible.

      Media Queries

      Media queries are a fundamental aspect of responsive web design, allowing developers to apply different styles based on the characteristics of the user’s device or viewport. However, they also introduce specific considerations regarding CSS specificity.

      Therefore, developers have to be mindful of specificity when nesting rules inside of media queries. If you are careful, you may avoid overriding rules you do not intend to override.

      Take this code, for example.

      HTML:

      <!DOCTYPE html>
      <html lang="en">
      <head>
      <meta charset="UTF-8" />
      <meta name="viewport" content="width=device-width, initial-scale=1.0" />
      <title>Document</title>
      <link rel="stylesheet" href="./style.css" />
      </head>
      <body>
      <nav>
      <h3>
      <a href="https://www.lambdatest.com/"
      ><img
      class="logo"
      src="https://www.lambdatest.com/resources/images/logos/logo.svg"
      alt="logo"
      /></a>
      </h3>
      <ul class="nav-items">
      <li><a href="https://www.lambdatest.com/feature">Platform</a></li>
      <li><a href="https://www.lambdatest.com/enterprise">Enterprise</a></li>
      <li><a href="https://www.lambdatest.com/blog/">Resources</a></li>
      <li>
      <a
      href="https://www.lambdatest.com/support/docs/getting-started-with-lambdatest-automation/"
      >Developers</a
      >
      </li>
      <li><a href="https://www.lambdatest.com/pricing">Pricing</a></li>
      
      
      <li>
      <a
      class="upgrade-btn"
      href="https://billing.lambdatest.com/billing/plans"
      >Upgrade</a
      >
      </li>
      </ul>
      <img
      class="hamburger"
      src="https://www.lambdatest.com/resources/images/icons/toggle_menu.svg"
      alt=""
      />
      </nav>
      
      
      <div class="signup">
      <div class="lamdatest-info">
      <h3>With your new LambdaTest Account, you get:</h3>
      <div class="offer">
      <p>&check;</p>
      <div>
      <h4>3000+ Browsers, OS, & Real Devices</h4>
      <p>
      Run manual and automated tests of web and mobile apps across 3000+
      different browsers, real devices, and OS environments.
      </p>
      </div>
      </div>
      <div class="offer">
      <p>&check;</p>
      <div>
      <h4>70% Faster Test Execution</h4>
      <p>
      LambdaTest's HyperExecute is up to 70% faster than any traditional
      cloud-based Selenium Grid.
      </p>
      </div>
      </div>
      <div class="offer">
      <p>&check;</p>
      <div>
      <h4>3000+ Browsers, OS, & Real Devices</h4>
      <p>
      Test smarter with AI-powered test insights to help you anticipate
      and mitigate future issues before they take root.
      </p>
      </div>
      </div>
      <p>Trusted by 2 Million+ users globally at:</p>
      <div class="companies">
      <img
      src="https://accounts.lambdatest.com/icons/logos/logo1.svg"
      alt=""
      />
      <img
      src="https://accounts.lambdatest.com/icons/logos/logo2.svg"
      alt=""
      />
      <img
      src="https://accounts.lambdatest.com/icons/logos/logo3.svg"
      alt=""
      />
      <img
      src="https://accounts.lambdatest.com/icons/logos/logo4.svg"
      alt=""
      />
      <img
      src="https://accounts.lambdatest.com/icons/logos/logo5.svg"
      alt=""
      />
      </div>
      </div>
      <form id="form">
      <h2>Get started for free</h2>
      
      
      <div class="platforms">
      <a 
      href="https://accounts.google.com/o/oauth2/auth/oauthchooseaccount?client_id=706758774682-bjrjup3sgcqmqm1n4dq62pk72mvu8mhn.apps.googleusercontent.com&redirect_uri=https%3A%2F%2Faccounts.lambdatest.com%2Flogin%2Fgoogle%2Fcallback&scope=openid%20profile%20email&response_type=code&state=Kz4s0sM1i5Sa8v74vOBkteLIljh1cDn4YQpcvnSG&service=lso&o2v=1&theme=glif&flowName=GeneralOAuthFlow"
      class="platform-button"
      target="_blank"
      >
      <img
      src="https://raw.githubusercontent.com/Cejay101/LamdaTestImages/e863498d271de5c15fcce14ee75bad4aad55bc7d/images/google-color-svgrepo-com.svg"
      alt="google icon"
      />Sign up with Google</a
      >
      <a 
      href="https://github.com/login/oauth/authorize?client_id=b41139b9749e27d4487b&redirect_uri=https%3A%2F%2Faccounts.lambdatest.com%2Flogin%2Fgithub%2Fcallback%2Fv1&scope=user%3Aemail&response_type=code&state=mA5eziVBDxkmH1LwCJT9k1uID3mSVm3W8Jf8ohJo"
      class="platform-button"
      target="_blank"
      ><img
      src="https://raw.githubusercontent.com/Cejay101/LamdaTestImages/e863498d271de5c15fcce14ee75bad4aad55bc7d/images/github-142-svgrepo-com.svg"
      alt="Github icon"
      />Sign up with Github</a
      >
      </div>
      <div class="alt-text">
      <div></div>
      <p>OR SIGNUP VIA MAIL</p>
      <div></div>
      </div>
      <div class="field">
      <label for="name">Name </label>
      <input type="name" id="name" placeholder="e.g Clinton joy" />
      </div>
      
      
      <div class="field">
      <label for="email">Business Email</label>
      <input type="email" id="email" placeholder="e.g clinton@gmail.com" />
      </div>
      <div class="field">
      <label for="password">Desired Password</label>
      <input type="password" id="password" />
      </div>
      <div class="field">
      <input type="submit" id="submit" value="SIGN UP"/>
      </div>
      
      
      By clicking Sign Up or registering through a third party you accept
      the LambdaTest
      <a href="https://www.lambdatest.com/legal/terms-of-service"
      >Terms of Service </a
      >and acknowledge the
      <a href="https://www.lambdatest.com/legal/privacy">Privacy Policy</a>
      and
      <a href="https://www.lambdatest.com/legal/cookie">Cookie Policy</a>
      </p>
      <p class="signin-text">
      Already have an account?
      <a
      href="https://accounts.lambdatest.com/login?_gl=1*cz6gbh*_gcl_au*MTU1OTQzNjIzMS4xNjg5ODI4OTQ5"
      >Sign In</a
      >
      </p>
      </form>
      </div>
      </body>
      </html>

      CSS:

      @import url("https://fonts.googleapis.com/css2?family=Nunito:wght@400;700&display=swap");
      
      
      * {
      margin: 0;
      padding: 0;
      }
      body {
      background-color: #ffffff;
      font-family: "Nunito", sans-serif;
      }
      a {
      text-decoration: none;
      }
      
      
      /* Nav bar */
      
      
      nav img {
      width: 200px;
      }
      .nav-items {
      list-style: none;
      gap: 2rem;
      display: flex;
      align-items: center;
      }
      nav a:hover {
      color: #56bbc6;
      }
      nav {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 1rem;
      font-size: 1.2rem;
      background-color: white;
      box-shadow: 0px 0px 25px #888888;
      position: relative;
      }
      nav a {
      color: #000000;
      text-decoration: none;
      }
      nav .upgrade-btn {
      background: linear-gradient(90deg, #3532ec, #800080);
      color: white;
      border: none;
      border-radius: 5px;
      padding: 10px 20px;
      }
      nav .upgrade-btn:hover {
      background: linear-gradient(90deg, #211f98, #5b075b);
      color: white;
      }
      
      
      .hamburger {
      display: none;
      }
      .signup {
      display: flex;
      }
      
      
      /* Lambdatest info */
      .lamdatest-info {
      padding: 5rem;
      background-color: #eef5fe;
      }
      .lamdatest-info h3 {
      font-size: 1.8rem;
      margin-bottom: 3rem;
      }
      .offer {
      display: flex;
      gap: 2rem;
      font-size: 1.5rem;
      margin-bottom: 3rem;
      }
      .lamdatest-info p {
      font-size: 1.2rem;
      margin-bottom: 2rem;
      }
      
      
      .companies img {
      width: 150px;
      }
      
      
      /* Form */
      #form {
      padding: 3rem;
      max-width: 100vw;
      }
      img {
      width: 20px;
      }
      h2 {
      font-size: 3rem;
      color: rgb(36, 54, 96);
      text-align: center;
      }
      .platforms {
      display: flex;
      gap: 2rem;
      margin: 2rem;
      justify-content: center;
      }
      .platforms a {
      display: flex;
      gap: 5px;
      }
      .platform-button {
      background: none;
      color: rgb(36, 54, 96);
      border: 2px solid transparent;
      border-image: linear-gradient(90deg, #0000ff, #800080);
      border-image-slice: 1;
      border-image-width: 2px;
      border-image-outset: 0;
      border-radius: 0px;
      padding: 10px 20px;
      cursor: pointer;
      }
      .platform-button:hover {
      background: linear-gradient(90deg, #e2e2f1, #f1d3f1);
      }
      .alt-text {
      text-align: center;
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin: 2rem 0;
      }
      .alt-text div {
      background-color: rgba(198, 198, 198, 0.383);
      height: 2px;
      display: inline-table;
      width: 35%;
      }
      .field {
      margin-bottom: 1.5rem;
      position: relative;
      }
      label {
      font-size: 1rem;
      color: rgb(36, 54, 96);
      }
      input {
      display: block;
      padding: 1rem;
      width: 100%;
      font-family: "Nunito", sans-serif;
      box-sizing: border-box;
      font-size: 1rem;
      border: 1px solid rgb(188, 188, 188);
      border-radius: 5px;
      }
      input[type="submit"] {
      margin-bottom: 2rem;
      font-family: "Nunito", sans-serif;
      width: 100%;
      background: linear-gradient(90deg, #3532ec, #800080);
      color: white;
      border: none;
      border-radius: 5px;
      padding: 15px 20px;
      cursor: pointer;
      }
      input[type="submit"]:hover {
      background: linear-gradient(90deg, #1e1cbf, #5b0b5b);
      }
      input:hover {
      background-color: rgb(232, 236, 239);
      }
      .signin-text {
      margin-top: 4rem;
      text-align: center;
      }
      
      
      @media screen and (max-width: 1252px) {
      .hamburger {
      display: block;
      width: 30px;
      }
      .nav-items {
      display: none;
      }
      .signup {
      flex-direction: column-reverse;
      }
      }
      @media screen and (max-width: 502px) {
      .lamdatest-info {
      padding: 2rem 1rem;
      }
      .lamdatest-info h3 {
      font-size: 1.5rem;
      }
      .offer {
      gap: 1rem;
      font-size: 1.2rem;
      margin-bottom: 1rem;
      }
      .lamdatest-info p {
      font-size: 1rem;
      }
      .companies img {
      width: 100px;
      }
      #form h2 {
      font-size: 2rem;
      }
      .platforms {
      flex-direction: column;
      }
      .alt-text div {
      width: 20%;
      }
      }

      Browser Output:

      Screenshot of the design on desktop

      Screenshot of the design on desktop 1920×1080 without media queries

      Screenshot of the design on an iPad Pro with media queries

      Screenshot of the design on an iPad Pro with media queries

      Screenshot of the design on a Galaxy Note 10 with media queries

      Screenshot of the design on a Galaxy Note 10 with media queries

      As seen, media queries and CSS specificity can interact indirectly when used in combination to create responsive designs.

      When a media query condition is met (e.g., the screen width is within a specific range), it can cause a set of CSS rules to be applied or overridden. These rules, like any other CSS rules, may have selectors with varying specificity.

      If there are conflicting CSS rules within the styles the media query applies, CSS specificity will determine which rules take precedence. The rule with higher specificity will override rules with lower specificity.

      Whenever you combine media queries with additional CSS rules, be mindful of potential issues with specificity. For instance, selector overlap with existing rules may result in specificity conflicts when a media query modifies an element’s styles. By modifying your selector techniques or, where necessary, utilizing more precise selectors, you can learn how to handle specificity conflicts in media queries.

      Conclusion

      CSS specificity, a vital concept in web development, determines the priority of styles when conflicting CSS rules target the same HTML element. It works on a hierarchy where IDs carry more weight than classes and element selectors, while inline styles hold the highest precedence. This guides browsers in deciding which style declarations to apply, ensuring predictable and consistent styling across web pages.

      Understanding specificity is crucial for developers to maintain clean, efficient code and avoid unintended style conflicts. It allows for better management of styles in complex web projects, enabling the creation of maintainable stylesheets and preventing unexpected style overrides.

      Frequently Asked Questions (FAQs)

      What is specificity in CSS?

      Specificity in CSS refers to the set of rules that determine which style declarations are applied to an HTML element when multiple conflicting styles are defined. It’s based on the combination of selectors used to target an element and assigns a numerical value to determine which rule takes precedence.

      What is the specificity of not in CSS?

      The specificity of the not pseudo-class in CSS is relatively low. When you use :not(selector) to exclude specific elements from a rule, it doesn’t significantly impact the overall specificity of the rule. It’s often used to fine-tune styles without significantly altering specificity.

      ]]>
      A Beginner’s Guide to Static Site Generator https://www.lambdatest.com/blog/static-site-generator/ Thu, 30 Nov 2023 18:00:33 +0000 https://www.lambdatest.com/blog/?p=62326 Continue reading A Beginner’s Guide to Static Site Generator ]]>

      When someone creates a website, they have two paths to choose from – dynamic or static. For people who are clear about the architecture of their application, this choice is easy to make. However, an extremely large portion of web creators, including organizations that provide such services, would generally jump on a framework they have previously worked on (or have expertise in). For instance, WordPress developers would generally always start with the CMS, even if the website should have been static.

      While both paths will eventually present your index page when the domain name hits the browser, a wrong choice would create irreversible weaknesses unless the developers are ready to recreate the complete website on a different platform. To eliminate this confusion and enlighten the readers on both choices, this guide will help them make the correct decision in the future.

      In this blog, you will learn everything you need to know to start with Static Site Generator, including its importance, types, and examples.

      What are Static and Dynamic websites?

      A website contains three elements:

      • A presentation layer that contains the user interface part.
      • A logical layer that contains the logic, such as what would happen if the user clicks this or the other element on the presentation layer.
      • A database (storage layer) on which queries are executed and data is fetched out according to the query.

      Out of these three elements, the website is termed static if only one is present, i.e., the presentation layer. Otherwise, it is a dynamic website.

      So, what is the difference an end-user would see? A static website has only static web pages displayed through the presentation layer. By being static, they exhibit a constant behavior to all the users who access them, as they do not have to implement any logic behind the scenes. For instance, a blog or news website will always show all users the same pages and content. Although, this is not true with dynamic web applications.

      static

      A blog website for reference

      Dynamic web applications take the user’s actions as input, implement certain logic, query the database, and then provide the output. As a result, the output could be different for different users. For instance, a popular content streaming website, Netflix, shows different recommendations on the home page and to other users. This output consistently changes as the user interacts with different content over time.

      web application

      A recommendation system example for Netflix

      Although this is just one of the applications of dynamic web applications, a user’s interaction might not always be needed, as in Netflix or Instagram. Some dynamic web applications use content and databases to apply logic independently and then provide the results. For instance, a real estate web application that provides live bid support needs to consider each bid and show it to other users. Even if the website doesn’t have the bid feature but shows the currently available properties by first filtering out sold properties, it becomes a dynamic website.

      The concise filtering of the properties of static and dynamic websites looks as follows:

      Static website Dynamic website
      The website's content is static, i.e. does not change. The content of the website can change at runtime.
      Database connections do not exist. The webpages can connect to the database and query the data as per actions.
      The languages used are HTML, CSS, and Javascript. The languages used are static website languages and a backend server language such as PHP, Python, Java, etc.
      The user’s actions do not manipulate the content. User’s actions can manipulate the content depending on the website logic.

      Dynamic websites may also contain other features (such as machine learning for recommendations) that will not be available in static websites. These should be included in the above scenario as well.

      So, in short, Static websites are a type of web architecture where the content is fixed and remains the same for all users. These websites present pre-built, unchanging information to visitors and do not dynamically generate content based on user interactions or inputs. Dynamic websites are web architecture where the content is generated on the fly in response to user requests and interactions. Unlike static websites, dynamic websites use server-side technologies to assemble and deliver content dynamically, allowing for a more interactive and personalized user experience.

      Info Note

      Test your Static websites on 3000+ real environments. Try LambdaTest Today!

      Advantages of a Static Site

      Static websites have various advantages over dynamic websites:

      • Speed: No pre-processing and no querying of the database means that static websites are extremely fast, a factor which is extremely important today considering that the users expect the load time to be 1 to 2 seconds. In addition, the developers get the added advantage of hosting their website on a slower connection.
      • Economic development: A static site involves fewer components corresponding to the application’s presentation. From a web application’s point of view, logical and database parts are harder to create and manage, so developers charge more for these services. A static site is easier and cheaper to create, therefore.
      • Easy to build and maintain: Owing to fewer connections and complexities, static websites are extremely easy to build and maintain in the future, including regular updates that can be done quickly. This will save a lot of time and costs.
      • Secure: Static websites do not connect to the database or contain sensitive information, including personal information such as credentials. Hence, there is not much left for the hackers, and if a user is surfing on a static website, they can be sure of their safety.
      • Better SEO rankings: Static websites are faster; therefore, they are automatically preferred by search engines due to their speed. They are also extremely specific, so the user rarely lands on them unnecessarily, increasing the session time. All this contributes to the search rankings.

      These advantages are crucial in bringing revenue to the organization and reaching as many users as possible.

      Disadvantages of a Static Site

      While there are weighted advantages to developing and owning a static website, it also has disadvantages.

      • Restricted: As one may already guess, a static website’s flexibility may restrict a developer from providing rich functionalities. This is an important factor to consider when referencing long-term.
      • Limited user experience: Due to the restrictions posed in the first point, the features that could enhance a user’s experience (such as personalized content) cannot be implemented on a static website. Since user experience is one of the contributing factors to the growth of a website, static websites have to compensate for it through content and limited resources.

      If these disadvantages do not bother a developer or the owner, a static website can be the best decision.

      What are Static Site Generators (SSG)?

      For a developer thinking of moving ahead directly by creating static web pages, this approach has a big problem. While it may look like a straightforward job for the first time, consider what would happen when a slight change is requested after publishing the website. Since no engine is used to create these pages, they behave as independent entities, so each will require the same change. The scale of this problem will be as big as the website itself and will consume a lot of time for the team.

      A better way to construct a static website is using static site generators. As the name suggests, static site generators build a static website using a templating engine. This templating engine (that differs from generator to generator) provides a basic skeleton for the web pages on which the actual code written for each of them is rendered. These pages are expected to be in HTML commonly, although depending on the generator, Markdown, reStructuredText, AsciiDoc, and others can also be accepted.

      The nature of fitting the page into the template and not having any backend connections with a server language or the database enables static site generators to eliminate any pre-processing involved in the process. This is why static websites can load at lightning-fast speeds compared to dynamic websites. Technically and ideally, the webpage is ready to be served even before any request is made, and the page is always reliable as the content is static. This is also called “advanced web page generation” and “on-demand web page generation” in dynamic websites.

      A Brief Introduction to Templating Engines

      In the definition of static site generators, the term “templating engine” seems to be the core part of generators. For unfamiliar people, a templating engine is developed to provide a basic template for the web pages involved in the website.

      To understand this, first, we need to sort out things we know will be common among all the web pages before starting the development. For a basic website, they could be as follows:

      • A header such as a navigation bar.
      • Design of the header.
      • Options are available on the header.
      • Footer.
      • Design of the footer.
      • Options are available on the footer.
      • The design of the main content.

      These are quite standard across all the web applications. So, a templating engine asks for these common elements to be designed as a single page, which is separate from others. Let’s call this page as base.html

      <!DOCTYPE html>
      <html lang="en">
          <head>
              <meta charset="UTF-8">
             {% block title % } {% endblock % }
          </head>
          <body>
              <header>
                  {% block header %}
                      <script src = “myJS”></script>
      	   <link src = “myCSS”>
                  {% endblock %}
              </header>
      <body>
              <div id="container">
      
      {% block content %}
      {% endblock %}
      </div>      
          <div id = “footer”>
                  {% block footer %}
                  {% endblock %}
              </div>
          </body>
      </html>

      This is our base.html, written in the Nunjucks templating engine, and has already included all the CDN links and other files required on each web page. Notice something unique in this HTML file that is not seen normally – use “{% %}”. These are called “blocks” in the templating engine and are implemented so the engine can recognize at which point it needs to insert which content. A block is written as a “block” keyword followed by the block’s name, which can be anything. The same name needs to go on each page where the developer uses this block.

      For instance, let’s say a page needs to add this template. It will make use of the block part as follows:

      {% block title % }
      <title>Dashboard </title>
      {% endblock %}

      On this page, the developer uses the title block and inserts the < title > tags within. By looking at the block name, the templating engine will match its location with the base template and insert this content within the block limits.

      This method allows a templating engine to easily reuse the template and apply the same to all the web pages. Please note here that templating engines are also used in dynamic websites, and they exhibit extended features in those applications. For instance, the Jinja templating engine can apply logic such as

      {% if request.user.is_authenticated %}

      To only render certain content when the user is logged in. However, such functionalities are not involved in static websites, making this an easy-to-learn and quick-to-develop process.

      Why should we use Static Site Generators?

      Everything on the Internet started with a static website when Tim Berner’s Lee published the official home page for the World Wide Web. The website space was growing but was constrained to unidirectional knowledge transfer, i.e., showing information from the website to the user. There were fewer inputs from the user, and none would extract them, churn them out, or design logical patterns.

      Slowly, there was a need to enhance the user experience by dynamically changing the content based on the end user. This devised complex techniques and design mechanisms that were highly popular during the second decade of the 21st century. SQL had also started to become a mainstream thing in the website space, and combining both of them would prove to be the most effective cocktail, even if it was highly complex and messy at the back end.

      Today, times have changed. Developers and organizations want to enhance the user experience, but not at the cost of a developer’s experience. A web application’s management and designing should be fun and easy to innovate new technologies as time goes by. Today, we see a dramatic shift from dynamic to static space because technologies have started to convert them accordingly.

      Take the example of CDNs. A CDN has completely changed how we connect many heavy elements to our websites. What required a block of code, processing to check the availability, updates, etc., is now just a single line in the HTML page. If a developer wants to connect social media tweets, just a link is enough!

      Twitter

      A small example of a live Twitter (now X) feed on a website

      Another example is login mechanisms that have changed over the past ten years. The user is always looking to keep their password counts to a minimum, a nightmare in the 2000s. Every website requires a password, and creating an account and keeping records is not so comforting. An alternative method is to use OAuth to get a third-party login instead; in this way, a user can access hundreds of websites by remembering one’s password. These days, passkeys have eliminated that process as well, but that is the talk for another day.

      user login

      An example of how third-party logins are presented on a website

      Eliminating such codes has resulted in a shift from dynamic to static applications. If we could achieve the same level of functionality and manage to load the website within the first second, there is nothing better than that. All this can be achieved by building static websites using static site generators. Along with it, during the development process, there are additional benefits:

      Minimum steps to major changes

      Static site generators come with a templating engine. As demonstrated above, they provide blocks to relate each web page’s location and insert data accurately. Due to this, changes are done only at a single place (commonly on base.html) and will reflect on all the subsequent pages.

      Faster maintenance and quick development

      As the code is minimized by eliminating repetitiveness, developers can accomplish much more in less time. This is true not only for first-time development but also for the changes to be made in the future as the cost of maintenance.

      Easily scalable

      Two different things happen at dynamic websites and static websites, respectively. When we add a new page to a dynamic website, we eventually add more pre-processing logic for the server and the database. Would that slow down the overall experience? Definitely! A single page will have a minor effect (although it depends on the logic), but it will soon combine and become noticeable to the end user.

      On the other hand, when we add a new page to the static website using a static site generator, we add just the static light-weight code, which is also done by removing the code already added into the base.html (as an example). Moreover, no processing is involved except for the client side, which is lightning-fast anyway. Hence, developers and website owners need not worry about adding large resources and expanding teams when developing their web applications.

      Highly secure

      The use of static site generators creates a website with static assets. These assets are exactly presented as they are available and can even be handled by CDNs. Moreover, these websites are built and ready to be displayed even before the request, as there is nothing to fetch and process from the server or the database. All this leaves very few holes as the most vulnerable point of attack is often the server or the database and its data.

      Version controlling

      Static site generators often come with their version control system. They provide historical data about the changes and are extremely easy to run (often pushing changes with a single command through the shell). Sometimes, these version control systems are connected to the deployment process, providing hosting services, easy website deployment, and making changes easily through the UI (dashboard).

      With people shifting towards static websites and static site generators facilitating this process, these reasons are probably enough to start our static site journey, even if for experimental purposes as an experience.

      A few examples of websites built using static site generators are:

      Bootstrap

      The official website of Bootstrap is made using Jekyll.

      static Bootstrap

      Kubernetes

      The official website of Kubernetes uses Hugo’s static site generator.

      Kubernetes

      OpenAI

      The website openai.com is built on Nuxt – a powerful generator for Vue components.

      OpenAI

      National Geographic

      The UK version of National Geographic is built on the Gatsby static site generator.

      National Geographic

      WebdriverIO

      The official website of WebdriverIO is built using the Docusaurus static site generator.

      WebdriverIO

      These are a few from a long list of popular websites that may look dynamically built but, in reality, are executed through the magical spin of static site generators.

      Types of Static Site Generators

      The shift to static websites and their exigent strengths has attracted many developers (especially open source) to collaborate and develop static site generators in large numbers. For someone active on open source contribution, a long list awaits on the repository hosting platforms such as GitHub. To filter out the work for beginners, here we have listed the most popular (by their usage) static site generators available for free today.

      Jekyll

      A static site generator of 2008, Jekyll has been into popular web development since then and has only become popular. By 2017, it was ranked the most popular generator and has been adopted by GitHub to host static websites, also officially called GitHub pages. The static site generator is made in Ruby and can take Markdown, Liquid, and Textile inputs. This could be one of the best options for people just starting their journey of static site generators.

      Nuxt

      Another easy-to-deploy static website generator is Nuxt, a Javascript library largely based on Vue.js and uses its components-based methodology to develop static web pages. The library is always praised for its “intuitive” nature, can be used for full-stack development, and allows the development of server rendering pages. Nuxt is fast and simple and has an extremely easy list of standards and conventions.

      Next.js

      Next.js is a static site generator. It is better known as a “complete framework for static websites” because it can create a complex web application with server-side code. Next.js is based on React and requires Node.js to be installed on the system.

      The main strength of Next.js is that the generator builds the application on the server side first and then renders the same to the client side. Therefore, it does not deal with the issues dealt with by other Javascript-based generators, such as security loopholes, large load times, and search engine optimization issues.

      One of the best examples of how to leverage the full abilities of Next.js is seen on LambdaTest, an online cross-browser testing platform, as shown below:

      Static LambdaTest

      The website is equipped with different functionalities that, in a way, showcase the power of Next as a support on a full-fledged website serving millions of users. Exploring the website and its complex features is recommended for more experience.

      Hugo

      Promoting itself as “The world’s fastest framework for building websites”, Hugo has always been highlighted as fast in development (with less than 1 ms page build time) and great at writing visual elements. The generator boasts its security feature: secure sandboxing elements and access-based solid restrictions. For instance, a security policy in Hugo declares the list of features that can access the build. Anything outside that does not allow access or build functionalities for the Hugo executable. Another example is the virtual file system provided by the generator that only allows the main project (not third-party components) to mount them outside the project.

      Hugo supports multiple metadata types, such as JSON and YAML, along with a Live Reload feature to reflect the changes as they are made on the codebase. For data-related activities, the developers can also use RSS and Google Analytics to gather and infer certain patterns based on the data.

      Gatsby

      Gatsby is a react-based static site generator. Hence, it comes with the power of React and ease of working as it is made for static sites. It is free to use, open-source, and capable of creating highly scalable applications quickly. One of Gatsby’s main strengths is the support for loading data from any source and using it in the application. It provides a centralized data layer and an option to choose the rendering option for better control over the application.

      Pelican

      Pelican is a static site generator using Python programming to generate a website. It is widely used because the website created using it can be hosted on any web server or hosting service. Pelican is efficient enough to take simple text files (such as Markdown) as input and use the command line to regenerate HTML, CSS, and Javascript out of it.

      Pelican also provides a unique feature of selective output and content caching, making the build and rebuild much quicker. For people migrating from CMS-based frameworks such as WordPress, Pelican can import the existing data and connect the plugins to the static website for extended functionality.

      This list just represents the most popular static site generators (based on GitHub forks and stars) available for free to use for the programmer. All of them are diverse, actively developed, and easy to learn and use, which saves a lot of time, especially when the developer is not experienced with static site generators.

      How do you choose a Static Site Generator?

      Many static site generators are available today that need to be clarified for the developers or the organizations as to which one to pick for the best results. By the nature of static site generators, they will all be much quicker to build and run the static web pages, especially if the comparison is with CMS frameworks and other such dynamic website creators. So, what parameters could we highlight that help the developers shortlist the most optimum generators for their project?

      • Scalability: The first parameter is the ability to scale the applications in the future. A web application can occasionally be moved to another framework or technology yearly. It would take a lot of work and costs to perform this task. Hence, developers are always advised to adopt only those technologies that won’t hinder the scalability programs.
      • Ease of use: Team members would join and leave the team regularly with time. If a technology is not easy to learn and use, a lot of the time will go into training the new members and will become a regular cost in the balance sheet. Such high costs can be avoided by adopting technologies that are easy to use, as per the team members.
      • Community: A big community in static site generators or any other software will always help the developers at any time of the day. Therefore, Choosing a generator with an established community is always advisable, and the developers do not wander around spending too much time on small issues.
      • Underlying versatility: Finally, the last thing a developer should consider is the different types of websites a static site generator supports. Some generators only allow extremely simple content-based websites like blogs and news-based applications. Others may even allow server scripting with CDN support. It all depends on the target application in the end. If the motive will be content-based, it is recommended not to adopt complex static site generators because they bring complex methods and execution flow with them along with flexibility. This could disrupt the learning curve for the teammates.

      Such parameters must always be considered before selecting a new static site generator, as it will be with you for a long time.

      Static Site Generator with Partial Rendering

      Finally, when searching for that perfect static site generator, you will come across the “new-age” generators made on top of libraries and frameworks that have already proven their mettle on the ground. The most common among those will be Next.js and React.js, which are common and popular and provide a multi-directional working method including server, serverless, and client-side code.

      When generators are made on top of such technologies (such as Nuxt), developers try to provide additional features that may be adopted as per convenience. Their most popular feature will be seen in the rendering department. While static site generators need static pages, partial rendering provides a server-based approach with the help of CDNs. In such cases, a few files must be kept on the server with the help of static web pages generated in the directory during the build process. The internal mechanism will depend on the underlying technology here.

      Partial rendering and dynamic capabilities are not like static site generators but have eventually been incorporated into them for a better development experience. Developers do pay for this by sacrificing the page load time and, ultimately, the user experience. If this matches your project’s requirements, we recommend exploring this area of static site generators in detail through official documentation.

      Testing a Simple Static Website

      A basic static website presents identical content to all visitors and relies heavily on its user interface with limited functionalities. Examining various design elements across different browsers and operating systems is crucial when testing such a website. This involves assessing components like font size, spacing, font style, and color for consistency. Additionally, thorough testing includes verifying the functionality of contact forms, ensuring that images are displayed correctly, and checking for any broken links on the site.

      Given the variations in how different browsers render websites, it is crucial to conduct testing across a wide array of browsers and their various versions. However, staying current with the latest browser updates can be challenging. In this scenario, a cloud-based testing platform like LambdaTest is the most favorable choice.

      LambdaTest is an AI-powered test orchestration and execution platform to perform manual and automation testing on an online browser farm of 3000+ real browsers, devices, and platform combinations.

      To start manually testing your static website, please follow the steps below:

      1. Log in to your LambdaTest account.
      2. LambdaTest Account

      3. Select Real Time > Browser Testing.
      4. Real Time Browser Testing

      5. Select the preferred browser, its version, operating system specification, and resolution from the list of choices. Click START after entering the target web URL.
      6. Start

      The web application will start running on the cloud machine with the selected specification in a couple of seconds.

      cloud machine

      Moreover, you can also perform automation testing through the LambdaTest cloud, which supports a wider range of frameworks, including Selenium, Playwright, and Cypress.

      Subscribe to our LambdaTest YouTube Channel for the latest tutorials on Selenium automation testing, mobile app testing, and more.

      Conclusion

      The Internet world started with static websites – simple textual websites with no “experience” but just information for the user. However, when the competition became fierce and newer ideas started to get converted into digital form, web applications evolved astronomically within twenty years. A significant step in this evolution was the connection of databases and backend logic into the web application.

      With both elements incorporated into the application, the website does not exhibit a constant behavior. It starts to act according to the user’s actions, storing sensitive user details (such as their photographs) and creating their personal spaces through the login system. As one can easily guess, this architecture is complex to develop and highly vulnerable to hackers. Due to these issues, the world is again moving towards static sites for good. However, it is not the 1990s, and we are not required to code everything from scratch. This is where static site generators come into play.

      Static site generators are the engines that build and generate static web pages to show to the user. They eliminate repetitiveness from the system and provide a robust skeleton on which developers can focus just on website designs and architecture. Today, they are numerous and provide great features for developers. This post explores all those angles of static site generators and defines their importance and methods of execution in the market today. With this, the developers will be able to measure the weight of each site generator by themselves and select the most optimum one for their next project.

      Frequently Asked Questions (FAQs)

      Is React a static site generator?

      No, React is a JS library that helps in building user interfaces as a single-page application. However, React Static is a static site generator based on the React library.

      What is an example of static sites?

      Blog websites, resume hosting websites, travel itinerary websites, and news websites are examples of static sites.

      Do I need a static site generator?

      If you are building a static site, doing so with a static site generator would be the best choice. It will reduce creation and maintenance time, optimize SEO, and improve overall performance.

      ]]>
      Guide To Chrome Developer Tools https://www.lambdatest.com/blog/chrome-developer-tools/ Thu, 30 Nov 2023 17:24:38 +0000 https://www.lambdatest.com/blog/?p=62171 Continue reading Guide To Chrome Developer Tools ]]>

      For front-end developers and testers, finding and fixing bugs in the web app can be tough sometimes because of unexpected data from the API call and uncertain user interactions. All modern browsers have a developer tool to debug errors in the code.

      Developer tools allow developers and testers to view and modify the HTML/CSS and JavaScript of the web page opened. It can also modify the DOM elements directly through the browser.

      Google Chrome, one of the most popular browsers, also has built-in developer tools called Chrome Developer Tools. This article will guide you on using Chrome developer tools for debugging and testing web applications.

      What are Chrome Developer Tools?

      Chrome Developer Tools or Chrome DevTools is a set of web development tools built into the Google Chrome browser that lets us inspect, edit, and debug our code and measure our page’s performance. These tools let developers see the changes on web pages in real time, diagnose problems more quickly, and build a better website. Explore 25 Best Debugging Tools for 2023, which will help you debug seamlessly.

      How to Access Chrome Developer Tools?

      To access the Chrome developer tools, developers may use the following three methods:

      • The easiest one is using keyboard shortcuts i.e. Ctrl + Shift + J in Windows and cmd + Option + J in Mac.
      • Open the browser menu by clicking on the three dots in the upper right corner, scroll down to the More tools option, and select the Developer tools option.
      • Right-click on the web page to debug and click on the Inspect option.

      Different Components of Chrome Developer Tools

      Chrome Developer Tools

      As you can see in the above image, the Chrome debugger has nine panels. All these panels are responsible for different debugging tasks. Here is a quick summary of what each panel is mainly responsible for.

      1. Elements: It can inspect and edit HTML elements and CSS style attributes.
      2. Console: Mainly responsible for viewing logs and executing JavaScript code.
      3. Sources: Used to debug JavaScript, edit JavaScript, add breakpoints, etc.
      4. Network: Responsible for viewing and debugging network-related activities.
      5. Performance: Used to analyze the web page load speed and optimization.
      6. Memory: Assists in tracking memory usage and fixing memory-related issues.
      7. Application: It inspects cookies, localStorage, sessionStorage, IndexDB, and any other local database.
      8. Security: Used to debug certificates and other security problems.
      9. Lighthouse: It audits the web app/website’s SEO, performance, quality, accessibility, etc.

      Let’s have a detailed look at all these nine panels in detail.

      Elements Panel

      The elements panel lets developers inspect and modify the HTML and CSS of the web page. With the elements panel, we can modify the code directly in the browser and see those changes instantly reflected on the web page.

      Developers and testers mainly use the elements panel to experiment with the HTML structure or the web page’s design. Its features include a color picker, responsive screen sizes, CSS editor, layout analyzer, animation builder, event listeners, and rulers.

      Elements Panel

      To inspect and modify any component we need to select that using the selection tool icon on the top right corner or by pressing Ctrl + Shift + C or Cmd + Shift + C as a shortcut. This will display the HTML/Document Object Model (DOM) and CSS for that component in the elements panel. Next, we can modify the HTML or CSS for that component. Any changes we make will be immediately reflected on the page and will not affect the source file directly.

      Console Panel

      The console panel of the Chrome debugger is primarily used to write and execute JavaScript codes. We can also see the log output created by our website in this panel. To open the console panel, we can click on the console panel tab in the Chrome devTools.

      Console Panel

      This permits real-time examination of variable values using the Chrome developer tools’ console panel. Developers and testers may put various console.log() statements in their code and then see their output in the console panel as the user interacts with the browser.

      Sources Panel

      The sources panel allows developers and testers to view source code or bundle output. This panel is primarily used for complex JavaScript debugging. Here, we can view our source files and set up multiple breakpoints, watch variables and their values, and perform the majority of debugging. It contains a file tree that can navigate through all source code files. To open the sources panel, we can click the sources panel tab in the Chrome developer tools.

      Sources Panel

      As shown in the image above, the sources panel has three primary components.

      • On the left, we have the File Navigator pane; it lists a file tree of the web app, including HTML, CSS, JavaScript, and other files, including assets attached to the web app. Chrome extensions’ files may also appear here.
      • In the center, the Code Editor pane displays all the source codes for the files selected from the File Navigator.
      • On the right, we have the JavaScript Debugging pane, which is especially used for debugging the JavaScript code.

      Learn How To Debug JavaScript Using Chrome Debugger.

      Info Note

      Elevate JavaScript based web app testing with LambdaTest’s AI-Orchestrated cloud. Test smarter. Try LambdaTest Today!

      Network Panel

      The network panel is mainly used to detect any upload or download request made by the webpage using the network. We can log and analyze all network activity in the log section.

      The network panel in Chrome DevTools has a waterfall graph for all the resources loaded in the web app. This waterfall graph helps us measure the individual performance of each asset, resource, and API endpoint; hence, it can be used to improve the network performance of the web app. Furthermore, we can filter our time required by different types of resources like Fetch/XHR (for API requests), JavaScript, CSS, Img, Media, Font, Doc, and others.

      To analyze the web app’s network performance using the Chrome Developer’s tool we can open the network panel by clicking on the Network tab. Next, we may clear all previous logs by clicking on the clear icon. Finally, we can refresh our web page to get the network log and real time waterfall graph of the website.

      Network Panel

      The network panel is used to monitor the number of requests made by a web page, total data transferred, loading time taken, resources downloaded or uploaded, caching performance, and other network-related activities. This information helps developers and testers to optimize individual resources and the web app.

      Performance Panel

      The performance panel in Chrome DevTools allows developers and testers to measure the page load performance of a web app. This is achieved by running a performance analysis on the web page and generating metrics on various aspects of the page load process, like the time taken by the web page to display, various network resources to load, and the web page to be interactive. To open the performance panel, we can click on the performance tab on the Chrome developer tools.

      Performance Panel

      The record and reload page button in the performance panel of Chrome DevTools allows developers and testers to run performance analysis on a web page and view detailed metrics about how the page is rendering and loading. By clicking the reload button, the tool will simulate a user visiting and interacting with the web page, providing information about the page load process in graphs and screenshots.

      Detailed performance analysis on the LambdaTest website is shown below.

      performance analysis

      We can even interact with call stacks and check functions that may consume more time, block the main thread, and delay the TTI (Time To Interactive) metric. Selecting a function provides all kinds of information for that function. We can check how long that function was executed and what other functions it called, and we can also open the function in the sources panel.

      Memory Panel

      The memory panel in Chrome developer tools provides advanced insight into the web page’s memory consumption. We can inspect memory usage by component, snapshot heap allocation, and record allocation timelines.

      The memory panel detects and fixes memory-related issues like leaks, bloats, and garbage collections. To open the memory panel, we can click on the memory tab on the Chrome developer tools.

      Memory Panel

      This screen shows a summary of the memory used by the web page by analyzing the total JavaScript heap size of the web page. Detailed memory consumption data by the web page can be generated by clicking on the Take Snapshot button.

      The Chrome DevTools memory panel allows us to select from three profiling types.

      • Heap Snapshot
      • This is one of the most commonly used memory profiling types. It allows you to take a snapshot of the JavaScript heap at a specific point in time. This snapshot shows the memory distribution between various JavaScript and related DOM elements of the web page.

      • Allocation instrumentation on time
      • This profiling type provides us with the memory distribution between various JavaScript and DOM elements over time while scrolling and interacting with the web page.

      • Allocation Sampling
      • The Allocation Sampling view maps memory consumption for individual page components like frames, documents, web workers, and graphics layers. This profiling type indicates the source of any high memory consumption.

      Application Panel

      The application panel in Chrome developer tools is used to inspect and edit the manifest file, service worker, cookies, localDB, sessionStorage, and other local databases. This panel is also used to view the website’s metadata, protocols, and icons.

      To open the application panel, click on the Application tab in the Chrome DevTools.

      Application Panel

      The application panel is mainly helpful in inspecting the progressive web apps that use local storage and API. This helps developers and testers manage storage, caches, and databases; inspect and clear cookies; and inspect Resources.

      Security Panel

      The security panel in Chrome developer tools displays connection security information for all network requests. This panel is used to determine if the data collected through network requests are secure or not. The website or network request will display a green lock icon if it is secure.

      This panel can be used to view SSL certificates and encryption types of each network request and overall website. To open the security panel, we can click on the Security tab in the Chrome DevTools.

      Security Panel

      As shown in the image above, the security panel provides information about

      • Certificate verification, indicating whether the website has proven its identity with a TLS certificate.
      • TLS connection, indicating whether the website uses a modern and secure protocol.
      • Subresource security indicates whether the website loads insecure HTTP subresources (mixed content).

      Lighthouse Panel

      Google Lighthouse is an open-source, free tool that can help developers and testers analyze and improve the website’s performance, speed, and overall experience by generating a Lighthouse report.

      The lighthouse panel in Chrome developer tools is equipped with Google Lighthouse, which can audit the website without any extra plugins or widgets. To audit a website on Chrome DevTool follow the steps below:

      1. Navigate to the Lighthouse tab on Chrome developer tools.
      2. Click on the “Generate Report” button in the image below.

      Lighthouse Panel

      It allows us to assess a website’s SEO, performance, accessibility, best practices in code, and progressive web app. It is also highly configurable, making it flexible and useful for all types of sites, from the simple to the highly complex. This flexibility includes several categories to run audits on both mobile and desktop devices.

      Auditing the website uses a 1 to 100 scoring system based on tests run against a simulated 4G connection of the selected data. A generated report for the LambdaTest home page is shown below.

      generated report

      Info Note

      Test your website’s compatibility on the cloud Selenium Grid of 3000+ real browsers. Try LambdaTest Today!

      Common Use Cases of Chrome Developer Tools

      Chrome developer tools can be used in various scenarios to help us develop better websites. Here are a few common use cases of Chrome developer tools:

      • Check responsiveness
      • Front-end developers and testers most commonly use Chrome developer tools to check the responsiveness of websites. It allows managing viewport appearance using both free scaling and preselected sizes. This feature is available in the elements panel.

      • Style into the website
      • If we are trying to improve the design of an existing web page, we can navigate to one already existing and inspect it with Chrome developer tools. So if layout, sizing, colors, or design is an issue, we can modify the CSS and check if our copy still looks good in the environment it will be displayed. Finally, we can make the same change in our actual code base by copy-pasting.

      • Identify issues in the website
      • Chrome developer tools are commonly used to identify bugs and issues in the code. We can check the API requests and responses, JavaScript source files, and HTML files. We can even analyze and audit our page’s performance to improve our website.

      • Catch non-working plugins
      • Almost every website relies on a third-party plugin and widgets. Whether for analytics tools, form or popup tools, or chat add-ons, it’s crucial to keep track of whether they are working properly. Chrome DevTools can greatly help us in testing the performance of these tools.

      Cloud Based Developer Tools

      Although the Chrome developer tools running on our physical devices can greatly help us analyze and improve the website performance in various aspects, we must ensure that our website performs the same in all different browser versions, platforms, and devices. To achieve this, we may run real time testing on cloud based testing tools.

      Cloud-based automation tools are handy because they can test our app in almost all popular browsers and platforms, ensuring better quality assurance for the web app. One such popular cloud based testing platform trusted by large enterprises as well as startups is LambdaTest.

      With LambdaTest you can pace up cross browser testing while performing interactive and live testing on desktop and mobile browsers with our native cloud-based browser developers tools.

      How To Launch Developer Tools On LambdaTest?

      To launch developer tools on LambdaTest, we can follow the steps below:

      1. Before proceeding we must create a LambdaTest account by registering for free and then navigate to the dashboard.
      2. Navigate to the real time testing dashboard by clicking the Real Time button from the left navigation menu.
      3. navigation menu

      4. Select the test configuration as per your choice. You can select from 8 different browsers on desktop and phone devices & their hundreds of versions to perform a real time test session. You may also select from multiple operating systems and screen resolutions for evaluating the website when rendered across various devices of different screen sizes.
      5. different screen sizes

      6. After selecting browser configuration, enter a URL and hit the Start button to start testing.
      7. selecting browser configuration

      8. For desktop devices: Once the desired virtual machine is launched and operable, Right-click anywhere on the loaded webpage and click on the Inspect option.
        For desktop devices

        For mobile devices: If your selected configuration of VM is a mobile device and once it is launched and operable, you can notice controller buttons on the left side of the screen. Click the icon button with the tools icon to open developer tools.

      9. mobile devices

      Bonus Chrome Developer Extension for Pro Debugging

      LambdaTest brings a brand new Chrome extension called LT Debug to make the life of testers and developers easy and fuss-free while debugging. This free developer tool is simple to use with over nine amazing features used by web developers and testers during debugging on a day-by-day basis.

      Even though there are various debugging tools in the market, we believe we are one among them! Here are some top reasons to trust our LT Debug Chrome extension:

      • It’s free to use forever.
      • All you need to do is fill out a simple form and start your debugging.
      • It provides access to 100+ extensions, to make the life of developers and testers easier.

      Here is our simple step-by-step guide on the installation process of LT debug:

      Step 1: Go to the official LT Debug Chrome Extension page.

      LT debug

      Step 2: Press the Add to Chrome button. You will be redirected to the Chrome web store.

      add to chrome

      Step 3: Now press the Add to Chrome button on the top right. A pop-up will appear asking if you want to add “LT Debug” to the browser. Tap on Add extension.

      add extension

      Step 4: All done! Now, you can select the feature you want to use and start debugging.

      start debugging

      Conclusion

      So there you have it! This article provides a basic overview of how Chrome developer tools can be used to test and debug your web apps and how you can use developer tools to test your web apps with cloud based testing tools. We also discussed some common use cases where Chrome developer tools can greatly help the developers.

      Frequently Asked Questions (FAQs)

      How to open developer tools in Chrome?

      To open the Chrome developer tools, developers may use three methods: a.) The easiest one is using keyboard shortcuts i.e. Ctrl + Shift + J in Windows and cmd + Option + J in Mac. b.)Open the browser menu by clicking on the three dots in the upper right corner, scroll down to the “More tools” option, and select the “Developer tools” option. c.) Right-click on the web page to debug and click on the “Inspect” option.

      How to check API calls in Chrome developer tools?

      The network panel in Chrome DevTools is mainly used to detect any upload or download request made by the webpage using the network. We can log and analyze all network activity in the log section. To check API requests only, we can filter out network requests of the category Fetch/XHR to check API requests.

      How to check cookies in Chrome developer tools?

      The application panel in Chrome developer tools is used to check and edit the cookies and other local databases stored by the website on our browser. To open the application panel, click on the Application tab in the Chrome DevTools.

      How to use Chrome developer tools?

      Chrome developer tools offer various functionalities for web development. It can inspect and edit HTML/CSS, debug JavaScript, analyze network activity, including API calls, manage cookies and local storage, optimize performance, and assess security aspects. The tools also integrate Lighthouse for comprehensive web page audits. Staying updated with these features enhances web development efficiency and troubleshooting capabilities

      ]]>
      Using pytest asyncio to Reduce Test Execution Time https://www.lambdatest.com/blog/pytest-asyncio-to-reduce-test-execution-time/ Thu, 30 Nov 2023 14:36:14 +0000 https://www.lambdatest.com/blog/?p=61983 Continue reading Using pytest asyncio to Reduce Test Execution Time ]]>

      Test execution time refers to the duration it takes for a suite of tests to run within the software testing process. This aspect profoundly impacts various stages of the development life cycle.

      When the execution times are shorter, it allows for faster feedback loops, enabling developers to identify and address any issues during the development phase quickly. This agility is crucial in maintaining an efficient continuous integration process, accelerating the release cycle, and enhancing overall software quality.

      Additionally, shorter test times optimize resource utilization, enabling support for parallel test execution strategies and positively impacting the productivity and satisfaction of development teams. On the other hand, longer test execution times can hinder development cycles, slow down continuous integration pipelines, and impede overall responsiveness in the software development process. Therefore, optimizing test execution time is critical in achieving streamlined, agile, and high-quality software development processes.

      When discussing decreasing execution time for automated test cases, the first thought is parallel execution of test cases. But is a parallel execution the only solution for this problem or is the test execution bottleneck of the test automation framework? We should ask ourselves this question whenever we want to reduce test execution time.

      This blog will look into different ways of managing test execution time and how pytest asyncio helps reduce test execution time.

      Methods to Reduce Test Execution Time

      When it comes to managing and optimizing test execution time in pytest, two main approaches are prominent: the classical setup and teardown mechanism and harnessing the potential of asynchronous programming using asyncio.

      • Using Setup and Teardown mechanism
      • Using asyncio mechanism

      First, let’s talk about automated test cases. Each automated test case contains three main parts: Setup, Actual Test Case, and Teardown. In the Setup process, we perform all necessary actions to prepare the environment for test execution. Those actions include reading or writing data from a database, performing API requests, reading or writing data from specific files, etc. After the process, we can start with the Test Case execution process, where test steps and assertions will be executed. As a final stage, the process of Teardown will be executed to revert all changes made during the setup and test execution process.

      Setup and Teardown in pytest

      Setup and Teardown process can be performed by Fixtures. Fixtures in pytest are a very powerful feature, and by definition, they present a Python function that pytest executes before and after the actual test function. So, let’s look at how to make a Fixture:

      @pytest.fixture()
      def first_fixture():
          """" This fixture will return result from 2 + 2 """
          return 2 + 2

      Fixture implementation is fully flexible (which can be concluded from the example above), but the right question is: “Where is the before and after part in this fixture?”. For the setup and teardown process, we need to implement the Fixture as a generator function using the yield keyword. So, everything before the yield keyword will be considered as setup, and everything after the yield keyword will be considered a teardown. This is how it looks in our example:

      @pytest.fixture()
      def first_fixture():
         """"This fixture will calculate 2 + 2 as setup process and print message as teardown process"""
         result = 2 + 2 # before actual test function
         yield result
         print("Start Teardown") # after actual test function

      After implementing the Fixture, we are ready to write the first test case:

      @pytest.mark.usefixtures("first_fixture")
      def test_first(first_fixture):
         """First test"""
         result_from_fixture = first_fixture
      
      
         assert result_from_fixture == 4

      So far, we have implemented one Fixture with setup and teardown process and one test case that uses the implemented Fixture. From this point, we can set up a problem that can be solved with pytest asyncio. Imagine a situation where you implemented 200 automated test cases and ran them in parallel, but still, test execution takes too long.

      The first step is to detect bottlenecks in the framework or to give an answer to the question, “Where do we have time leakage? ”. For this purpose, we will set up the problem situation like this:

      We will add one more test case and modify the test case with time.sleep() to simulate test case execution time:

      @pytest.mark.usefixtures("first_fixture")
      def test_first(self, first_fixture):
         """First test"""
         result_from_fixture = first_fixture
         time.sleep(2)
         assert result_from_fixture == 4
      
      @pytest.mark.usefixtures("first_fixture")
      def test_second(self, first_fixture):
         """Second test"""
         result_from_fixture = first_fixture
         time.sleep(2)
         assert result_from_fixture == 4

      Also, to simulate precondition functions, we will add to the function that time execution will also be simulated with time.sleep():

      def first_precondition_function():
         logging.info("First Precondition function called")
         time.sleep(3)
         logging.info("First Precondition function finished")
      
      
      def second_precondition_function():
         logging.info("Second Precondition function called")
         time.sleep(3)
         logging.info("Second Precondition function finished")

      At the end, let’s modify the Fixture to execute precondition functions:

      @pytest.fixture()
      def first_fixture():
         """"This fixture will calculate 2 + 2 as setup process and  print message as teardown process"""
         result = 2 + 2 # before actual test function
      
         # precondition functions
         logging.info("Precondition started")
         first_precondition_function()
         second_precondition_function()
         logging.info("Precondition finished")
      
         yield result
      
         logging.info("\nStart Teardown")# after actual test function

      From the execution report, we can see the following results:

      ============================= 2 passed in 16.19s ==============================
      2023-11-05 14:40:19,102 [INFO] Precondition started
      2023-11-05 14:40:19,103 [INFO] First Precondition function called
      2023-11-05 14:40:22,103 [INFO] First Precondition function finished
      2023-11-05 14:40:22,103 [INFO] Second Precondition function called
      2023-11-05 14:40:25,104 [INFO] Second Precondition function finished
      2023-11-05 14:40:25,104 [INFO] Precondition finished
      PASSED                            	[ 50%]2023-11-05 14:40:27,107 [INFO] Start Teardown
      2023-11-05 14:40:27,109 [INFO] Precondition started
      2023-11-05 14:40:27,109 [INFO] First Precondition function called
      2023-11-05 14:40:30,110 [INFO] First Precondition function finished
      2023-11-05 14:40:30,110 [INFO] Second Precondition function called
      2023-11-05 14:40:33,111 [INFO] Second Precondition function finished
      2023-11-05 14:40:33,111 [INFO] Precondition finished
      PASSED                           	[100%]2023-11-05 14:40:35,114 [INFO] Start Teardown

      As a starting point, we should detect and count bottlenecks in the framework:

      • 1st Bottleneck: Assume 2 seconds for test execution is the best time we can achieve with the current test implementation. For the execution of two test cases, we need 4 seconds.
      • 2nd Bottleneck: Assume that 3 seconds for precondition execution is the best time we can achieve with the current implementation. For execution precondition functions, we need 6 seconds per test case.

      We have set up the problem situation and can discuss possible solutions for the bottlenecks. The solution for the first bottleneck is obvious: we need to introduce parallel execution, and we will reduce test time execution from 4 seconds to 2 seconds. But, with parallel execution, we will not solve the second bottleneck, and there are an additional 6 seconds in total time execution.

      ============================== 2 passed in 9.54s ==============================
      
      test_blog.py::TestBlog::test_second 2023-11-05 14:57:38,953 [INFO] Precondition started
      2023-11-05 14:57:38,953 [INFO] First Precondition function called
      2023-11-05 14:57:41,954 [INFO] First Precondition function finished
      2023-11-05 14:57:41,954 [INFO] Second Precondition function called
      2023-11-05 14:57:44,956 [INFO] Second Precondition function finished
      2023-11-05 14:57:44,956 [INFO] Precondition finished
      
      [gw0] [ 50%] PASSED test_blog.py::TestBlog::test_first 2023-11-05 14:57:46,959 [INFO] Start Teardown
      2023-11-05 14:57:38,964 [INFO] Precondition started
      2023-11-05 14:57:38,965 [INFO] First Precondition function called
      2023-11-05 14:57:41,966 [INFO] First Precondition function finished
      2023-11-05 14:57:41,966 [INFO] Second Precondition function called
      2023-11-05 14:57:44,967 [INFO] Second Precondition function finished
      2023-11-05 14:57:44,967 [INFO] Precondition finished
      
      [gw1] [100%] PASSED test_blog.py::TestBlog::test_second 2023-11-05 14:57:46,970 [INFO] Start Teardown

      Asyncio Module in Python

      Asyncio is a powerful Python module that enables developers to write asynchronous code by leveraging the intuitive async/await syntax. This module is especially valuable when dealing with I/O-bound operations, including network requests, file operations, and other tasks requiring external resources. Introduced in Python 3.4, the asyncio module has emerged as an integral component of Python’s robust asynchronous programming capabilities. It provides a structured and consistent approach to asynchronous programming using coroutines, the event loop, and other related concepts.

      How to use asyncio with pytest?

      Our goal with pytest asyncio is to run two precondition functions concurrently. To achieve such a goal, it is necessary to create coroutines from precondition functions:

      async def first_precondition_function():
         logging.info("First Precondition function called")
         await asyncio.sleep(3)
         logging.info("First Precondition function finished")
      
      
      async def second_precondition_function():
         logging.info("Second Precondition function called")
         await asyncio.sleep(3)
         logging.info("Second Precondition function finished")

      To run coroutines concurrently, we need to use await asyncio.gather:

      @pytest.fixture()
      async def first_fixture():
         """"This fixture will calculate 2 + 2 as setup process and print message as teardown process"""
         result = 2 + 2 # before actual test function
      
         # precondition functions
         logging.info("Precondition started")
         await asyncio.gather(first_precondition_function(), second_precondition_function())
      
         logging.info("Precondition finished")
         yield result
         logging.info("Start Teardown") # after actual test function

      At the end, we need to make test functions also coroutines. To do that, pytest provides two possible solutions:

      • The first solution is to mark test functions with @pytest.mark.asyncio and use the keyword async:
      • @pytest.mark.asyncio
        @pytest.mark.usefixtures("first_fixture")
        async def test_first(self, first_fixture):
           """First test"""
           result_from_fixture = first_fixture
           time.sleep(2)
           assert result_from_fixture == 4
        
        @pytest.mark.asyncio
        @pytest.mark.usefixtures("first_fixture")
        async def test_second(self, first_fixture):
           """Second test"""
           result_from_fixture = first_fixture
           time.sleep(2)
           assert result_from_fixture == 4

      • The second solution is to set up the parameter asyncio_mode=auto in the pytest.ini file. In that case, we do not need to decorate the test function with marker @pytest.mark.asyncio:

      [pytest]
      asyncio_mode=auto

      Now, see the results:

      ============================== 2 passed in 6.50s ==============================
      
      test_blog.py::TestBlog::test_first 2023-11-07 22:04:22,972 [INFO] Precondition started
      2023-11-07 22:04:22,972 [INFO] First Precondition function called
      2023-11-07 22:04:22,973 [INFO] Second Precondition function called
      2023-11-07 22:04:25,985 [INFO] First Precondition function finished
      2023-11-07 22:04:25,985 [INFO] Second Precondition function finished
      2023-11-07 22:04:25,986 [INFO] Precondition finished
      
      [gw0] [ 50%] PASSED test_blog.py::TestBlog::test_first
      [gw1] [100%] PASSED test_blog.py::TestBlog::test_second 2023-11-07 22:04:27,989 [INFO] Start Teardown
      2023-11-07 22:04:22,970 [INFO] Precondition started
      2023-11-07 22:04:22,971 [INFO] First Precondition function called
      2023-11-07 22:04:22,971 [INFO] Second Precondition function called
      2023-11-07 22:04:25,969 [INFO] First Precondition function finished
      2023-11-07 22:04:25,969 [INFO] Second Precondition function finished
      2023-11-07 22:04:25,970 [INFO] Precondition finished
      2023-11-07 22:04:27,973 [INFO] Start Teardown

      From the results, we see that by the concurrent approach, we reduced execution time by 3 seconds and, in total, 10 seconds.

      Conclusion

      In conclusion, we delved into two powerful strategies, each tailored to optimize the efficiency of test execution in pytest. The approach of setup and teardown provides a structured means of preparing the testing environment before execution and cleaning up afterward, ensuring a consistent and controlled context for each test. Adopting asynchronous programming through pytest asyncio introduces a dynamic paradigm, particularly advantageous for handling I/O-bound tasks and achieving concurrent execution.

      By exploring both these approaches, you can balance meticulous test preparation and swift execution, ultimately reducing test execution time and enhancing the overall effectiveness of the testing process. Whether leveraging traditional setup practices or embracing the asynchronous capabilities of asyncio, pytest offers a robust framework for optimizing test workflows in diverse testing scenarios.

      ]]>
      Point of Sale (POS) Testing https://www.lambdatest.com/blog/point-of-sale-pos-testing/ Thu, 30 Nov 2023 13:57:05 +0000 https://www.lambdatest.com/blog/?p=62164 Continue reading Point of Sale (POS) Testing ]]>

      The retail industry, including physical stores and e-commerce, have experienced significant shift. In the light of rapidly evolving technological developments, business owners emphasize the security of transactional data on the backend for processing and approval as well as a seamless user experience on the front end of their online platforms.

      Think of a busy retail space, loaded shopping carts, and the thrill of a smooth checkout process. It is the outcome of a well tested and well-oiled Point of Sale (POS) system!

      In this blog we will look at what a Point of Sale system is and why is it important. Furthermore, we shall look into the significance of POS Testing, how it is different from conventional software testing and finally, we wrap it up looking at some of the best practices for doing POS Testing.

      What is a Point of Sale (POS) System?

      Point of Sale(POS) system is a digital cash register in retail stores and restaurants. It helps calculate the total cost of the items, add tax, take payment, manage inventories, sales reports, customer data, and transactions. It serves as a central point where customers make payments for goods or services. Now the question arises, what is POS testing? We can think of it as meticulous quality control for the digital cash registers. POS testing is a practice of testing the functionalities of a POS System. It includes security, peripheral device connectivity, and payment processing, ensuring a dependable and error-free transaction experience for both consumers and companies.

      Consequences of a Failing Point of Sale(POS) System

      When a POS system fails, the consequences can be severe:

      • Lost Sales: Transaction failures can result in lost sales, and customers may abandon their purchases due to delays or errors.
      • Customer Frustration: Frustrated customers may avoid returning to a business with a malfunctioning POS system, impacting customer loyalty.
      • Data Breaches: Security vulnerabilities can lead to data breaches, potentially causing severe financial and legal consequences.
      • Operational Chaos: Businesses can experience overstocking or shortages when their POS system does not work.

      Remember Target’s 2013 Data Breach? Target suffered a massive data breach due to vulnerabilities in its POS system. Hackers gained access to customer credit card data, affecting millions of customers. It teaches us that protecting POS systems is pivotal in ensuring customer data security and trust in the digital world.

      Importance of Point of Sale(POS) Testing

      POS testing ensures the smooth operation of Point of Sale systems. Let’s look at the crucial role of POS testing in maintaining system functionality.

      • Transaction Accuracy: POS systems handle a high volume of transactions daily. POS testing ensures that they accurately calculate prices, apply discounts, and process various payment methods without errors.
      • Data Security: Customer payment information and personal data are at stake. POS testing verifies that these systems are secure against data breaches and unauthorized access.
      • Inventory Management: Many POS systems are integrated with inventory management. POS testing guarantees that inventory levels are accurately tracked and prevent discrepancies.
      • Business Reputation: A well-functioning POS system enhances customer experience, enhancing a business’s reputation. It ensures that customers can complete transactions smoothly and without delays.

      Types of Point of Sale(POS) Testing

      The POS system operates at two levels, each requiring distinct types of testing:

      Types of Point of Sale(POS) Testing

      Application Level

      At the application level, the testing primarily concentrates on the functionalities and user interface of the POS system. Different types of testing used at this level are:

      • Functional Testing: Checks if the POS system functions as expected. Ensures core functionalities like item scanning, payment processing, and receipt generation work accurately without errors.
      • Compatibility Testing: Checks compatibility with different hardware and software configurations. Ensures seamless operation with diverse hardware components and software environments, offering flexibility for businesses with varying equipment.
      • Usability Testing: Evaluates the system’s user-friendliness and customer experience. Ensures the POS interface is intuitive, easy to navigate, and meets customer expectations, enhancing the checkout process and customer satisfaction.

      Enterprise Level

      At the enterprise level, the testing focuses on broader aspects like security, performance, and integration with external systems. Different types of testing used at this level are:

      • Security Testing: Identifies vulnerabilities and weaknesses in the system’s security. Assesses the system’s resistance to data breaches and unauthorized access, ensuring customer payment information is encrypted and protected.
      • Performance Testing: Evaluate the system’s performance under various conditions. Ensures the system can handle peak transaction loads without slowdown or crashes, optimizing performance and preventing delays during busy hours.
      • Regression Testing: Verifies that updates or changes do not negatively impact existing functionalities. Maintains system stability and reliability by preventing new bugs or issues from being introduced with software updates.
      • Interoperability Testing: Assesses how well the system integrates with external systems. Examines the integration with payment gateways, inventory management, and CRM systems, ensuring smooth communication and data exchange.

      Take your Point of Sale (POS) testing strategies to the next level with Top 267+ Retail Test Cases.

      Physical Components of POS System and How to Test Them?

      Let’s explore the physical components of POS systems and their testing focus.

      • Terminal: The POS terminal serves as the primary interface for transaction entry. Testing professionals validate the accuracy of product lists, pricing, offers, payment modes, verify the network connection, and update the operating system for software support.
      • Display Pole: Display showcases the price of scanned items. Testing professionals verify the accuracy of the prices here and ensure these are in sync with the POS terminal.
      • Barcode Reader: It is used to scan the product and perform backend checks. Testing professionals carefully check the system to make sure that all inventory items are scanned accurately, paying special attention to those without price tags. They also confirm that the scanning process is spot-on for items with the right price tags.
      • Cash Register: This acts as the central location for cash transactions. When the point-of-sale operator chooses the cash payment option, the Cash Register opens automatically. A thorough validation of financial transactions is ensured by ensuring the Cash Register accurately records deposited/refunded amounts.
      • Handheld Device: This facilitates wireless card payments. Testers verify the precision of manual amount entry, guaranteeing accuracy in every wireless card transaction.
      • Printer: Printer is connected to terminals for receipt generation. It is tested for receipt printing precision, alignment, text, and font accuracy. Error handling scenarios, such as printer readiness and paper availability, including system responses during printer downtime mid-transaction.
      • Magnetic Swipe Reader (MSR): It is designed for swiping payment cards. Testers validate balance checks, expiry dates, and payment transactions to ensure efficient initiation and prompt issuance of printed receipts.

      How is Point of Sale(POS) Testing Different?

      Point of Sale (POS) testing is distinct from conventional software testing processes due to its unique focus on customer-facing transactions and its critical role in a business’s daily operations.

      Aspect POS Testing Conventional Software Testing
      Focus Customer-facing transactions, payment processing, and system integration with peripheral devices. Overall software functionality, including features, usability, and performance across different services.
      Purpose Ensures accuracy, efficiency, and security of point-of-sale operations. Ensures software quality, reliability, and usability for the business’s end users.
      Testing Focus Customer experience, data security, and system performance under high transaction volumes. Overall software behavior, identifying bugs, and ensuring user acceptance.
      Compliance Validates adherence to PCI DSS(Payment Card Industry Data Security Standard), ensuring secure handling of sensitive payment information. Ensures compliance with industry standards and regulatory requirements, depending on the business domain.
      Peripheral Devices Tests integration with barcode scanners, receipt printers, and card readers. Primarily focuses on software functionalities, and may not extensively test hardware integrations.
      Criticality Critical for businesses relying on POS systems for daily transactions, ensuring smooth customer experience; for example, a retail store. Important for all software applications, but time-sensitiveness depends on the business domain.

      Whether it’s Point-of-Sale (POS) testing or conventional software testing, understanding the critical role testing plays in a product’s success is the key here. LambdaTest is an AI-powered test orchestration and execution platform that stands out as a leading cloud platform to test websites and mobile apps on more than 3000+ combinations of browsers, real devices, and operating systems. With LambdaTest’s Real Device Cloud, you can take the software testing experience even further by running tests on real devices to get a sense of how your product works on different types of devices.

      Challenges in Point of Sale(POS) Testing

      Let’s have a look at the challenges faced in POS testing:

      • Diverse Hardware and Software Environments: POS systems need to work with a wide range of hardware components, such as barcode scanners, receipt printers, and various software environments, including different operating systems. Ensuring compatibility across this diversity is a significant challenge.
      • Data Security Concerns: Given the sensitive nature of customer payment data, maintaining data security is a top priority. Testing for vulnerabilities and ensuring robust encryption is challenging but essential to protect customer information.
      • Integration with External Systems: Interoperability with external systems like payment gateways and inventory management is critical.
      • Scalability: As businesses(like retail stores, restaurants, and hotels) grow, the POS system must scale. Ensuring the system accommodates increasing products, customers, and transactions without performance degradation is a persistent challenge.
      • Data Backup and Recovery: Testing the effectiveness of data backup and recovery processes to safeguard against data loss or hardware failures requires meticulous planning.

      8 Best Practices for Point of Sale(POS) Testing

      Let’s look at some of the best practices which one must adhere to for POS Testing:

      • Clear Test Plan: Develop a well-structured test plan outlining the scope, objectives, and specific test cases for a comprehensive evaluation of the POS system.
      • Realistic Test Data: Utilize diverse and real-world test data, including various product types, prices, and payment methods to replicate actual scenarios.
      • End-to-end Testing: Ensure end-to-end testing that covers the complete sales process, from item scanning to payment processing and receipt generation, to evaluate the smooth operation of the entire system.
      • User Acceptance Testing (UAT): Engage actual users or representatives of your target audience to conduct UAT. Their feedback is essential to validate the system’s user-friendliness and alignment with user expectations.
      • Use Automation: Consider implementing test automation tools to streamline repetitive and regression testing, saving time and enhancing test coverage.
      • Data Backup and Recovery Testing: Regularly verify the efficiency of data backup and recovery procedures to ensure critical data can be restored in case of hardware failures or data loss.
      • Compliance Testing: If your business operates within a regulated industry, ensure that the POS system complies with industry-specific regulations and standards.

      Conclusion

      In exploring Point of Sale (POS) testing, we’ve uncovered its pivotal role in managing transactions, data security, and business inventory. Failing POS systems can lead to lost sales and data breaches. We’ve highlighted various POS testing types, challenges faced, and the best practices of POS testing. In a competitive market where customers demand smooth experiences, POS testing becomes the reason for success, assuring adaptability, data protection, and a good reputation for businesses.

      Frequently Asked Questions (FAQs)

      What is the difference between POS System and POS Testing?

      POS (Point of Sale) systems are used by businesses to streamline transactions, manage inventory, and enhance overall operational efficiency, while POS Testing focuses on validating the functionality and reliability of the POS system.

      Where are POS Systems used?

      POS Systems are used across diverse industries, including retail stores, restaurants, hospitality establishments, salons/spas, and service-oriented businesses.

      ]]>
      A Deep Dive Into Bootstrap Display and Visibility [Bootstrap Tutorial: Part III] https://www.lambdatest.com/blog/bootstrap-display-and-visibility/ Thu, 30 Nov 2023 13:30:34 +0000 https://www.lambdatest.com/blog/?p=62266 Continue reading A Deep Dive Into Bootstrap Display and Visibility [Bootstrap Tutorial: Part III] ]]>

      Today, web development and design, in general, is comparable to putting together a puzzle that fits on screens of various sizes and devices. As users access websites on a multitude of devices, such as phones, tablets, and laptops, the need for dynamic, responsive web layouts has become not just a trend but a necessity.

      However, web designers and developers face the intricate challenge of accommodating everything from pocket-sized smartphones to expansive desktop screens. From the smallest smartphones like the Unihertz Jelly Pro and Soyes S7 with 2.45 inches and 2.5 inches of screen size to the largest display monitor and video screen, the curved Samsung Odyssey Ark and Venetian Resort sphere, with respective sizes of 55 inches and 6192 inches.

      Odyssey Ark and Venetian Resort Sphere

      Odyssey Ark and Venetian Resort Sphere

      As the demand for responsive and accessible web layouts continues to rise, web developers and designers must leverage the power of Bootstrap display and visibility properties to create experiences that adapt and excel in this ever-changing landscape. Bootstrap is a free, versatile, powerful, and open-source frontend toolkit that empowers developers to produce products that smoothly respond to the unpredictable changing terrain of screen sizes and devices.

      Websites such as Visme, AnyDesk, and LogRocket have harnessed the Bootstrap display and visibility properties to create unforgettable experiences with responsiveness for their website users. The example below shows how the Visme website utilized Bootstrap flex to produce responsive cards that stuck vertically once they hit the lg breakpoint, making more content accessible to a broader audience.

      Visme website

      Source

       harnessed the Bootstrap display

      In our previous Bootstrap tutorial series, we looked at Bootstrap Dropdowns and Collapse and then explored Bootstrap Buttons and Badges. Using the skills and knowledge gained from these tutorials, we’ll explore more features of the Bootstrap toolkit.

      In this Bootstrap tutorial part III, we’ll traverse the world of Bootstrap display property and visibility utility. We will analyze how they work and how you can use their potential to improve the responsiveness of your website to make it more accessible and provide a better user experience.

      Introduction to Bootstrap Display and Bootstrap Visibility

      Let’s first have an introduction and overview of the Bootstrap display and visibility. This section will set the stage for what follows by providing an essential foundation for understanding Bootstrap visibility utility and display property and what they contain.

      Bootstrap Display

      The Bootstrap display property has a set of display utility classes. This comprises a portion of the values of the CSS display property itself.

      The utility classes apply across all the Bootstrap breakpoints: xs, sm, md, lg, xl, and xxl. The classes, in regards to breakpoints, are named using two formats: d-{value} for xs and d-{breakpoint}-{value} for all other breakpoints.

      The value in the format stands for all display property values that Bootstrap supports, such as inline, inline-block, table, and grid.

      Bootstrap display property is among the ways you can use to create responsive web designs alongside Bootstrap grid system and flexbox.

      Bootstrap Visibility

      The Bootstrap visibility utility modifies the visibility of elements without affecting the value of the Bootstrap display property.

      The Bootstrap visibility has two classes: invisible and visible. These classes do not affect the page’s layout. Elements with the invisible class still occupy space in the layout but cannot be visually seen. They are also hidden visually and from assistive technologies like screen readers.

      The most common use of Bootstrap visibility is toggling the visibility of elements between being visible and hidden.

      Info Note

      Test your Bootstrap websites across 3000+ desktop and mobile browsers. Try LambdaTest Today!

      Key Role of Element Visibility and Layout in Responsive Design

      For many factors, there are times when it is reasonable to display some elements on specific breakpoints and hide them on others. Let’s look at the relevance of managing the visibility of elements in responsive design.

      Ensuring Responsive Web Layouts

      The look of different layouts varies from one screen size to another. An image with large dimensions can look great on large screen sizes and vice versa. If a large image were to be displayed as it is on smaller screen sizes, it could refuse to adapt to the screen and, in turn, make the surrounding elements unresponsive, too.

      As such, showing and hiding certain elements on different screen sizes and devices can improve the responsiveness of the web page. Keeping a given element on a given screen size can prove very challenging to make the page or section responsive.

      For example, in the below images, Visme displays the images surrounding the text in the hero section on laptops. It, however, hides them when it comes to mobile phones, thus making handling the responsiveness of the section less complicated on such small screen sizes.

       Visme displays the images

       images surrounding the text

      For the above previews, I used the LT Browser. It is a next-generation browser built by LambdaTest for testing and debugging websites. It allows you to carry responsive testing for your websites and other web applications on multiple device viewports with up to 6 simultaneously, in addition to 53+ viewports, including mobile, tablet, and desktop.

      You can check out the LT Browser documentation to get started and ease the task of testing the responsiveness of your web designs on various devices.

      For continuous tutorials on automation testing, mobile app testing, and more, subscribe to our LambdaTest YouTube Channel.

      Improving Accessibility

      Among the many things responsive design caters to is user accessibility. Correctly controlling the visibility of elements enables screen readers and other assistive technologies to provide accurate information to differently-abled users.

      According to Itamar Medeiros, a UX Researcher and interaction designer, in an edition on Ask UXmatters, “Creating Websites that work with different devices is, in my opinion, a good start for accessibility… Some of the responsive design frameworks—like Bootstrap and Foundation—already provide out-of-the-box compliance to coding best practices.

      Web page elements irrelevant to screen readers, like decorative images, can be hidden using techniques like display:none or aria-hidden:true. This ensures that screen readers don’t interpret these elements, thus preventing confusion.

      Reducing Clutter

      When it comes to screen real estate, small screen devices have less of it compared to larger ones. Therefore, it makes it more sound to display the most critical elements on small screens to utilize the inadequate space. This prevents content from cluttering the web page, which can confuse users on how to interact with it.

      In the example below, LambdaTest displays an explainer image alongside the content on large-screen devices like laptops and hides on small mobile screens. This enables users to focus on what is crucial and make quicker decisions while on the website.

      Reducing Clutter

      LambdaTest displays an explainer image

      Expediting Loading Times

      The size of the markup or web page elements like images directly influences the loading time of a web page. The larger the markup size, the longer a page may take to load, or in the case of images, the heavier they are, the slower a page may load.

      According to ClickZ, one of the largest digital marketing agencies in the UK, the average size of a mobile webpage is 2.2MB, and images account for 68% of this size. Mobile phones usually have slower Internet connections than larger-screen devices like laptops. Hence, hiding elements such as images is essential to reduce the amount of data needed to load the page. This speeds up the page loading time compared to how it would be with the now hidden elements still showing.

      ClickZ, one of the largest digital marketing agencies

      Source

      As we head into Bootstrap display property and Bootstrap visibility, mastering the control of element visibility is crucial for crafting adaptive and user-friendly designs.

      Deep Diving Into Bootstrap Display Property

      The Bootstrap display property is a set of utility classes that supports most of the values of the CSS display property. It provides a responsive and flexible way to manage the display of elements based on screen size. Bootstrap supports different values of the CSS display property. The display classes use the format of d-{breakpoint}-{value}, except for breakpoint xs, which follows the format d-{value}.

      Below are some Bootstrap display classes and what they do.

      Class Description
      d-none Hides an element on all breakpoints.
      d-inline Displays the element as an inline.
      d-block Displays the element as a block.
      d-flex Displays the element as flex.
      d-inline-flex The element behaves as an inline element but lays its content using flex.
      d-grid Displays the element as a grid.
      d-inline-grid The element behaves as an inline element but lays its content using a grid.

      Responsive Display Classes

      Bootstrap also has responsive classes for the display ones, and they follow the pattern of d-{breakpoint}-{value}. Below are some of the responsive classes.

      Class Description
      d-sm-none Hides the element on the sm breakpoint.
      d-md-block Displays the element as a block on the md breakpoint.
      d-lg-flex Displays the element as flex on the lg breakpoint.
      d-xl-inline Displays the element as inline on the xl breakpoint.
      d-xxl-block Displays the element as a block on the xxl breakpoint.

      Display None

      The d-none class hides elements visually from the webpage, and they no longer occupy any space in the document flow. You can use the class for all breakpoints to cater to web page responsiveness.

      Shown below are the use cases of the display none:

      • Responsive web design: Concerning responsive web design, display none enables you to hide elements as the web page hits different breakpoints.
      • Tabbed navigation: Tabbed navigation is a navigation style that arranges content in separate sections represented by tabs where users can alternate between them.

      The example below shows how AnswerThePublic uses d-none to hide the image on other breakpoints and then shows it once it hits the lg breakpoint. This significantly improves the page load time for people on small-screen devices, enhancing the overall user experience.

      AnswerThePublic uses d-none

      Source

      improves the page load time

      <!DOCTYPE html>
      <html lang="en">
        <head>
          <meta charset="UTF-8">
          <meta http-equiv="X-UA-Compatible" content="IE=edge">
          <meta name="viewport" content="width=device-width, initial-scale=1.0">
          <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9" crossorigin="anonymous">
          <title>Bootstrap Display property -> d-none</title>
          <style>
            body::before {
              display: block;
              content: '';
              height: 70px;
            }
      
            .automation-img {
              height: auto;
              width: 650px;
            }
      
            .img {
              height: auto;
              width: 25px;
            }
          </style>
        </head> 
        <body class="bg-light">
          <nav class="navbar navbar-expand-lg bg-white py-4 fixed-top">
            <div class="container ms-auto">
              <a class="navbar-brand" href="#">
                <img src="https://www.lambdatest.com/resources/images/logos/logo.svg" alt="LambdaTest Logo" />
              </a>
      
              <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar-menu">
                <span class="navbar-toggler-icon"></span>
              </button>
      
              <div class="collapse navbar-collapse" id="navbar-menu">
                <ul class="navbar-nav ms-auto">
                  <li class="nav-item"><a href="" class="nav-link">Platform</a></li>
                  <li class="nav-item"><a href="" class="nav-link">Enterprise</a></li>
                  <li class="nav-item"><a href="" class="nav-link">Resources</a></li>
                  <li class="nav-item"><a href="" class="nav-link">Developers</a></li>
                  <li class="nav-item"><a href="" class="nav-link">Pricing</a></li>
                  <li class="d-flex gap-3 ms-lg-4 ms-md-0 ms-sm-0">
                    <a href="" class="nav-link">Login</a>
                    <!-- Modal trigger -->
                    <button class="btn btn-outline-dark" data-bs-toggle="modal" data-bs-target="#bookdemo" type="button">
                      Book a Demo
                    </button>
                    <!-- Modal trigger end -->
                    <a class="btn btn-dark" href="#" role="button">Sign Up</a>
                  </li>
                </ul>
              </div>
            </div>
          </nav>
          <!--  -->
          <section class="py-5 bg-light" style="min-height: 100vh;">
            <div class="container">
              <div class="row justify-content-center text-center">
                <h2 class="fs-1">Features of LambdaTest Enterprise Cloud</h2>
                <p class="fs-5 text-secondary">
                  LambdaTest fits perfectly in your CI/CD pipelines. Test early, debug accurately, and release faster with LambdaTest
                </p>
                <img class="automation-img d-lg-block d-md-block d-sm-none d-none" src="https://www.lambdatest.com/resources/images/all-mobile-frameworks.png" alt="Appium Automation testing">
              </div>
              <div class="row row-cols-sm-1 row-cols-md-3 row-cols-lg-3 row-cols-1 justify-content-center g-5 mt-2 px-4">
                <div>
                  <img src="https://www.lambdatest.com/resources/images/automation/Click-icon-button.svg" alt="">
                  <p class="fs-3 mt-3 mb-4">One-Click Upload</p>
                  <p class="fs-5 text-secondary mb-5">
                    Upload your .apk, .ipa, .app, or .zip files directly on the LambdaTest platform and start testing instantly.
                  </p>
                  <a class="link-info link-underline-opacity-0" style="font-size: 1.25rem;" href="#">
                    Contact Sales →
                  </a>
                </div>
                <div>
                  <img src="https://www.lambdatest.com/resources/images/automation/TunnelandLocalTesting1.svg" alt="">
                  <p class="fs-3 mt-3 mb-4">Test Locally or Privately</p>
                  <p class="fs-5 text-secondary mb-5">
                    Test your privately or locally hosted apps for compatibility before pushing them to a live environment.
                  </p>
                  <a class="link-info link-underline-opacity-0" style="font-size: 1.25rem;" href="#">
                    Contact Sales →
                  </a>
                </div>
                <div>
                  <img class="img" src="https://www.lambdatest.com/resources/images/automation/vector.svg" alt="">
                  <p class="fs-3 mt-3 mb-4">Seamless Integration</p>
                  <p class="fs-5 text-secondary mb-5">
                    Integrate end to end with all your complete test stack.
                  </p>
                  <a class="link-info link-underline-opacity-0" style="font-size: 1.25rem;" href="#">
                    Contact Sales →
                  </a>
                </div>
                <div>
                  <img src="https://www.lambdatest.com/resources/images/automation/logs-logo.svg" alt="">
                  <p class="fs-3 mt-3 mb-4">Enhanced Debugging With Real Time Logs</p>
                  <p class="fs-5 text-secondary mb-5">
                    Identify and debug native apps in real-time using device logs, network logs, app logs, screenshots and videos. Identify UI anomaly using inspect element.
                  </p>
                  <a class="link-info link-underline-opacity-0" style="font-size: 1.25rem;" href="#">
                    Contact Sales →
                  </a>
                </div>
                <div>
                  <img src="https://www.lambdatest.com/resources/images/automation/Analyticslogo1.svg" alt="">
                  <p class="fs-3 mt-3 mb-4">Mark Bugs</p>
                  <p class="fs-5 text-secondary mb-5">
                    Assign bugs directly from the LambdaTest platform or integrate with a project management tool of your choice.
                  </p>
                  <a class="link-info link-underline-opacity-0" style="font-size: 1.25rem;" href="#">
                    Contact Sales →
                  </a>
                </div>
                <div>
                  <img src="https://www.lambdatest.com/resources/images/automation/ManageDatalogo.svg" alt="">
                  <p class="fs-3 mt-3 mb-4">Test Logs and Detailed Insights</p>
                  <p class="fs-5 text-secondary mb-5">
                    Increase test execution speed and productivity with one-click bug logging, detailed test logs and insights that will help you deliver quality builds faster.
                  </p>
                  <a class="link-info link-underline-opacity-0" style="font-size: 1.25rem;" href="#">
                    Contact Sales →
                  </a>
                </div>
              </div>
            </div>
          </section>
      
          <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-HwwvtgBNo3bZJJLYd8oVXjrBZt8cqVSpeBNS5n7C8IVInixGAoxmnlMuBnhbgrkm" crossorigin="anonymous"></script>
        </body>
      </html>

      Browser output:

      In the above browser output, we have used the d-sm-none class to hide the image once the page hits the sm breakpoint. This makes the layout more responsive and reduces clutter on small-screen devices.

      See the Pen
      Bootstrap Visibility Utility & Display Property – Display: none
      by Mbaziira Ronald (@mbaziraofug)
      on CodePen.

      Display Inline

      The d-inline class is a utility class part of the Bootstrap display property. The class makes none inline elements on the web page display as inline. The elements with the d-inline class will allow the next elements to be on the same line if there is enough space; otherwise, they will begin on a new line.

      As inline elements, they exhibit some of the following characteristics:

      • They don’t start on a new line.
      • Height and width properties can’t apply to them. They take up as much space as their content occupies.
      • Horizontal margins and paddings are respected but not the vertical.
      • Inline elements allow other elements to be on the same line as theirs.

      Bootstrap has inline classes that you can use to create responsive layouts based on different breakpoints. Below are some classes.

      Class Description
      d-sm-inline Displays the element as inline when the page hits the sm breakpoint.
      d-md-inline Displays the element as inline when the page hits the md breakpoint.
      d-lg-inline Displays the element as inline when the page hits the lg breakpoint.

      Below are some common use cases of display inline:

      • Responsive web layouts: These are layouts that adapt to different devices and screen sizes.
      • Copyright information: These are details on the legal rights and intellectual property ownership of original works, usually put in the footer of a website.
      • Breadcrumb navigation: Breadcrumb navigation is a path of hierarchical links showing users their current location on a website.

      The example below shows how Cuttles uses the d-inline class to fit the copyright paragraph on the same line with the Terms of Service and Privacy Policy in the limited space at the bottom of the footer.

       limited space at the bottom of the footer

      Source

      copyright paragraph on the same line

      <!DOCTYPE html>
      <html lang="en">
       <head>
         <meta charset="UTF-8" />
         <meta http-equiv="X-UA-Compatible" content="IE=edge" />
         <meta name="viewport" content="width=device-width, initial-scale=1.0" />
         <link
           rel="stylesheet"
           href="./node_modules/bootstrap/dist/css/bootstrap.min.css"
         />
         <title>
           Bootstrap CSS Display property - display inline
         </title>
       </head>
       <body class="py-4">
         <div class="container">
           <h1 class="text-center mt-4 fs-5">
             Bootstrap CSS Display property - Display inline
           </h1>
           <!--  Before Display Inline  -->
           <p class="text-center mt-4"><strong>Before Display inline</strong></p>
           <div>
             <p class="bg-primary p-4 text-white text-center">
               Online Selenium Test Automation
             </p>
             <p class="bg-info p-4 text-center">Real Device Testing</p>
             <p class="bg-dark text-white p-4 text-center">Cross Browser Testing</p>
           </div>
      
      
           <!-- After Display inline    -->
           <p class="text-center mt-5 mb-5"><strong>After Display inline</strong></p>
           <div>
             <p class="bg-primary p-4 text-white text-center text-center d-inline">
               Online Selenium Test Automation
             </p>
             <p class="bg-info p-4 text-center d-inline">Real Device Testing</p>
             <p class="bg-dark text-white p-4 text-center d-inline">
               Cross Browser Testing
             </p>
           </div>
         </div>
      
      
         <script src="./node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
       </body>
      </html>

      Browser output:

       paragraphs displaying as inline elements

      The browser output above shows the paragraphs displaying as inline elements after applying the class d-inline on them.

      See the Pen
      Bootstrap CSS Display property- Display inline
      by Mbaziira Ronald (@mbaziraofug)
      on CodePen.

      Display Inline Block

      The class d-inline-block makes elements behave like inline elements while retaining some properties of block elements. Inline-block elements showcase the following characteristics:

      • Elements do not begin on a new line.
      • Properties of width and height are respected.
      • Elements can have vertical margins and paddings.

      Below are some of Bootstrap’s responsive classes for d-inline-block:

      Class Description
      d-lg-inline-block Displays the element as inline-block when the page hits the lg breakpoint.
      d-md-inline-block Displays the element as inline-block when the page hits the md breakpoint.
      d-xl-inline-block Displays the element as inline-block when the page hits the xl breakpoint.

      Below are some common use cases of display inline-block:

      • Button-like links: These are links styled to resemble buttons, making them visually eye-catching and encouraging user interaction.
      • Menu items: Navigation elements found in menus guide users to different sections or pages within a website or mobile application.
      • Horizontal lists: List items arranged horizontally enable websites to utilize little space where vertical lists could, such as in the footer to display items like navigation menus, social media icons, tags, and labels.
      • Links with inline icons or images: Links with small icons or images integrated directly with the link text serve as visual cues and prompt user interaction.

      The example below shows how AnyDesk uses the d-inline-block class to create a button-like link to Download Now. This is because, unlike the d-inline, which does not respect vertical margin and padding, and the d-block, which does not allow other elements to be placed along it, the d-inline-block caters to both.

       AnyDesk uses the d-inline-block

      Source

      margin and padding

      Visme uses the same class of d-inline-block to give the button-like links of Start Now a maximum width of 320px and vertical padding.

      Visme uses the same class of d-inline-block

      Source

      Code

      <!DOCTYPE html>
      <html lang="en">
        <head>
          <meta charset="UTF-8">
          <meta http-equiv="X-UA-Compatible" content="IE=edge">
          <meta name="viewport" content="width=device-width, initial-scale=1.0">
          <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9" crossorigin="anonymous">
          <title>Bootstrap Display property -> d-inline-block</title>
          <style>
            body::before {
              display: block;
              content: '';
              height: 90px;
            }
          </style>
        </head> 
        <body class="bg-light">
          <nav class="navbar navbar-expand-lg bg-white py-4 fixed-top">
            <div class="container ms-auto">
              <a class="navbar-brand" href="#">
                <img src="https://www.lambdatest.com/resources/images/logos/logo.svg" alt="LambdaTest Logo" />
              </a>
      
              <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar-menu">
                <span class="navbar-toggler-icon"></span>
              </button>
      
              <div class="collapse navbar-collapse" id="navbar-menu">
                <ul class="navbar-nav ms-auto">
                  <li class="nav-item"><a href="" class="nav-link">Platform</a></li>
                  <li class="nav-item"><a href="" class="nav-link">Enterprise</a></li>
                  <li class="nav-item"><a href="" class="nav-link">Resources</a></li>
                  <li class="nav-item"><a href="" class="nav-link">Developers</a></li>
                  <li class="nav-item"><a href="" class="nav-link">Pricing</a></li>
                  <li class="d-flex gap-3 ms-lg-4 ms-md-0 ms-sm-0">
                    <a href="" class="nav-link">Login</a>
                    <!-- Modal trigger -->
                    <button class="btn btn-outline-dark" data-bs-toggle="modal" data-bs-target="#bookdemo" type="button">
                      Book a Demo
                    </button>
                    <!-- Modal trigger end -->
                    <a class="btn btn-dark" href="#" role="button">Sign Up</a>
                  </li>
                </ul>
              </div>
            </div>
         </nav>
      <!--    -->
        <section class="py-5">
            <div class="container">
              <div class="d-flex flex-column align-items-center text-center">
                <h1>
                  Next-Generation Mobile Apps and <br> Cross Browser Testing Cloud
                </h1>
                <p class="lead">
                  Deliver unparalleled digital experience with our next-gen
                  AI-powered testing cloud platform. <br> Ensure exceptional user
                  experience across all devices and browsers.
                </p>
              </div>
              <section class="d-flex-column d-md-flex d-sm-flex-column px-4 px-md-none px-lg-none px-xl-none px-xxl-none pt-5 gap-3">
                <div class="mb-5 mb-md-0">
                  <h3 class="h4">
                    Online Selenium Test Automation on Desktop, Android, and iOS Mobile Browsers
                  </h3>
                  <p>
                    Run your Selenium test automation scripts across online Selenium Grid of desktop, Android and iOS mobile browsers. Develop, test, and deliver faster every time with automated cross browser testing using LambdaTest online Automation Browser Testing Grid.
                  </p>
                  <a class="d-inline-block pt-4 link-info link-underline-opacity-0" style="font-size: 1.25rem; color: #0FBAC5;" href="#">
                    Get Started
                    <img src="https://www.lambdatest.com/resources/images/right_arrow.svg" alt="">
                  </a>
                </div>
                <div class="mb-5 mb-md-0">
                  <h3 class="h4">Real Device Cloud for Reliable Mobile App Testing</h3>
                  <p>
                    Test your native hybrid of web mobile apps using LambdaTest's online real device cloud and virtual mobile device platform of emulators and simulators. Eliminating your in-house device labs and bring high scalability to your mobile app testing.
                  </p>
                  <a class="d-inline-block link-info link-underline-opacity-0 pt-4" style="font-size: 1.25rem; color: #0FBAC5;" href="#">
                    See more
                    <img src="https://www.lambdatest.com/resources/images/right_arrow.svg" alt="">
                  </a>
                </div>
                <div>
                  <h3 class="h4">Cross Browser Testing On Desktop And Mobile Browsers</h3>
                  <p>You can choose from a wide range of Windows and Mac operating systems, along with all legacy and latest browsers. Also test your website or web app on latest mobile browsers with Android and iOS mobile operating systems.</p>
                  <a class="d-inline-block link-info link-underline-opacity-0 pt-4" style="font-size: 1.25rem; color: #0FBAC5;" href="#">All Browser and Devices
                    <img src="https://www.lambdatest.com/resources/images/right_arrow.svg" alt="">
                  </a>
                </div>
              </section>
            </div>
          </section>
      
      
          <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-HwwvtgBNo3bZJJLYd8oVXjrBZt8cqVSpeBNS5n7C8IVInixGAoxmnlMuBnhbgrkm" crossorigin="anonymous"></script>
        </body>
      </html>

      Browser output:

      Browser output

      In the output above, we have used d-inline-block to place an arrow image alongside our links and give them a top padding of 4.

      See the Pen
      Display inline-block – Bootstrap Display property
      by Mbaziira Ronald (@mbaziraofug)
      on CodePen.

      Display Block

      The class d-block makes non-block elements display as block elements. The table below shows the responsive classes associated with the d-block class.

      Class Description
      d-sm-block Displays the element as a block once the page hits the sm breakpoint.
      d-md-block Displays the element as a block once the page hits the md breakpoint.
      d-lg-block Displays the element as a block once the page hits the lg breakpoint.

      Common use cases of display block are block buttons, responsive web layouts, modals, pop ups, overlays, and form buttons.

      LogRocket uses the d-md-block class to show the Request a Demo button once the page hits the md breakpoint and hides it on other breakpoints. One is shown on the screens below the md breakpoint, and the other on those above.

      breakpoints

      Source

      content

      <!DOCTYPE html>
      <html lang="en">
        <head>
          <meta charset="UTF-8">
          <meta http-equiv="X-UA-Compatible" content="IE=edge">
          <meta name="viewport" content="width=device-width, initial-scale=1.0">
          <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9" crossorigin="anonymous">
          <title>Bootstrap Display property -> d-block</title>
          <style>
            body::before {
              display: block;
              content: '';
              height: 100px;
            }
      
            .img {
              height: auto;
              width: 350px;
            }
          </style>
        </head>
        <body class="bg-light">
          <nav class="navbar navbar-expand-lg bg-white py-4 fixed-top">
            <div class="container ms-auto">
              <a class="navbar-brand" href="#">
                <img src="https://www.lambdatest.com/resources/images/logos/logo.svg" alt="LambdaTest Logo" />
              </a>
      
              <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar-menu">
                <span class="navbar-toggler-icon"></span>
              </button>
      
              <div class="collapse navbar-collapse" id="navbar-menu">
                <ul class="navbar-nav ms-auto">
                  <li class="nav-item"><a href="" class="nav-link">Platform</a></li>
                  <li class="nav-item"><a href="" class="nav-link">Enterprise</a></li>
                  <li class="nav-item"><a href="" class="nav-link">Resources</a></li>
                  <li class="nav-item"><a href="" class="nav-link">Developers</a></li>
                  <li class="nav-item"><a href="" class="nav-link">Pricing</a></li>
                  <li class="d-flex gap-3 ms-lg-4 ms-md-0 ms-sm-0">
                    <a href="" class="nav-link">Login</a>
                    <!-- Modal trigger -->
                    <button class="btn btn-outline-dark" data-bs-toggle="modal" data-bs-target="#bookdemo" type="button">
                      Book a Demo
                    </button>
                    <!-- Modal trigger end -->
                    <a class="btn btn-dark" href="#" role="button">Sign Up</a>
                  </li>
                </ul>
              </div>
            </div>
          </nav>
          <section class="text-center py-5">
            <div class="container">
              <h1 class="display-3 fw-bold">
                Secure Localhost Testing With UnderPass
              </h1>
              <p class="text-secondary lead">A GUI application that helps you test locally hosted pages or privately <br/> hosted projects on 3000+ browsers for desktop and mobile.</p>
            </div>
            <button class="btn btn-dark mt-3" type="button">DOWNLOAD UNDERPASS</button>
          </section>
          <section class="py-5 bg-white">
            <div class="container">
              <div class="d-flex align-items-center">
                <div class="order-1 ps-lg-5 ms-lg-5">
                  <h2 class="display-6 fw-semibold">One Click Launch To Trigger LambdaTest Tunnel</h2>
                  <p>No need to launch tunnel through CLI anymore. UnderPass will automatically execute the tunnel binary to establish a secure connection for testing locally hosted pages on LambdaTest.</p>
                  <button class="btn btn-dark">Underpass documentation</button>
                </div>
                <img class="img d-none d-none d-sm-none d-xxl-block d-xl-block d-lg-block" src="https://www.lambdatest.com/resources/images/One_Click.png" alt="">
              </div>
            </div>
          </section>
          <section class="py-5 bg-light">
            <div class="container">
              <div class="d-flex align-items-center">
                <div class="pe-lg-5 me-lg-5 me-0 pe-0">
                  <h2 class="display-6 fw-semibold">Test Websites with Private Certificate</h2>
                  <p>Underpass enable MITM (Man-in-the-middle) for website with self signed certificates. You can now test locally hosted or privately hosted websites using self signed certificates on your own system or internal network.</p>
                </div>
                <img class="img d-none d-none d-sm-none d-xxl-block d-xl-block d-lg-block" src="https://www.lambdatest.com/resources/images/MITM_Toggle.png" alt="">
              </div>
            </div>
          </section>
          <section class="py-5 bg-white">
            <div class="container">
              <div class="d-flex align-items-center">
                <div class="order-1 ps-lg-5 ms-lg-5 ms-0 ps-0">
                  <h2 class="display-6 fw-semibold">Localhost Testing Behind Proxy</h2>
                  <p>Perform Localhost testing to test websites hosted behind proxies. You can define PROXY HOST, PROXY PORT, PROXY USER and PROXY PASSWORD for your remote server, office network or even a local machine.
                  </p>
                  <button class="btn btn-dark">Underpass documentation</button>
                </div>
                <img class="img d-none d-none d-sm-none d-xxl-block d-xl-block d-lg-block" src="https://www.lambdatest.com/resources/images/Proxy_Server.png" alt="">
              </div>
            </div>
          </section>
        
      
          <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-HwwvtgBNo3bZJJLYd8oVXjrBZt8cqVSpeBNS5n7C8IVInixGAoxmnlMuBnhbgrkm" crossorigin="anonymous"></script>
        </body>
      </html>

      Browser output:

      In the example above, once the page hits the md and lower breakpoints, the images are hidden and vice versa once they hit the lg breakpoint and above.

      See the Pen
      Bootstrap Display Property -> d-block
      by Mbaziira Ronald (@mbaziraofug)
      on CodePen.

      Display Flex

      To give HTML containers or wrappers a display of flex, use the d-flex class. Below are some classes that go along with Bootstrap’s d-flex.

      Class Description
      flex-row Displays the content of the element based on flex
      flex-column Displays the content of the element as flex column
      flex-*-row This class format enables displaying the contents of an element as flex depending on the breakpoint. The * denotes the breakpoints.
      flex-*-column This class format enables displaying the contents of an element as flex, depending on the breakpoint. The * denotes the breakpoints.

      Common use cases of display flex in web development are image galleries, responsive nav menus, blog cards, footer menus, and responsive web layouts.

      LogRocket, in the example below, uses the d-flex, flex-column, and its associated classes to utilize the space to cater to both the text content and the image by displaying text content in a column layout.

      DOCTYPE

      Source

      Compatible

      <!DOCTYPE html>
      <html lang="en">
        <head>
          <meta charset="UTF-8">
          <meta http-equiv="X-UA-Compatible" content="IE=edge">
          <meta name="viewport" content="width=device-width, initial-scale=1.0">
          <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9" crossorigin="anonymous">
          <title>Bootstrap Display property -> d-flex</title>
          <style>
            body::before {
              display: block;
              content: '';
              height: 100px;
            }
      
            .section2 p {
              color: #808791;
            }
      
            .img {
              height: auto;
              width: 300px;
            }
          </style>
        </head> 
        <body style="background: #000;" class="pb-5">
          <nav class="navbar navbar-expand-lg bg-white py-4 fixed-top">
            <div class="container ms-auto">
              <a class="navbar-brand" href="#">
                <img src="https://www.lambdatest.com/resources/images/logos/logo.svg" alt="LambdaTest Logo" />
              </a>
      
              <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar-menu">
                <span class="navbar-toggler-icon"></span>
              </button>
      
              <div class="collapse navbar-collapse" id="navbar-menu">
                <ul class="navbar-nav ms-auto">
                  <li class="nav-item"><a href="" class="nav-link">Platform</a></li>
                  <li class="nav-item"><a href="" class="nav-link">Enterprise</a></li>
                  <li class="nav-item"><a href="" class="nav-link">Resources</a></li>
                  <li class="nav-item"><a href="" class="nav-link">Developers</a></li>
                  <li class="nav-item"><a href="" class="nav-link">Pricing</a></li>
                  <li class="d-flex gap-3 ms-lg-4 ms-md-0 ms-sm-0">
                    <a href="" class="nav-link">Login</a>
                    <!-- Modal trigger -->
                    <button class="btn btn-outline-dark" data-bs-toggle="modal" data-bs-target="#bookdemo" type="button">
                      Book a Demo
                    </button>
                    <!-- Modal trigger end -->
                    <a class="btn btn-dark" href="#" role="button">Sign Up</a>
                  </li>
                </ul>
              </div>
            </div>
          </nav>
          <!--  -->
         <section class="container">
           <div class="p-5 text-white" style="background: #171a21;">
            <div class="d-flex align-items-center justify-content-between">
              <div>
                <h1>LambdaTest Support and <br/> Knowledge Base</h1>
                <p class="lead pt-3 text-secondary">Helping you test web and mobile apps at scale.</p>
              </div>
              <div>
                <img class="img d-none d-lg-block d-md-block d-sm-none" src="https://www.lambdatest.com/support/assets/images/Illustration-cc7032867d0192b6e025a30cdffef9b2.png" alt="">
              </div>
            </div>
           </div>
           <section class="pt-5 section2">
             <p class="text-white h4 pb-3">AUTOMATION</p>
             <div class="d-flex gap-4 d-lg-flex d-md-flex d-sm-flex d-flex-column gap-4 px-3 px-sm-0 px-md-0 px-lg-0 px-xl-0">
               <div>
               <div class="border border-bottom-0 border-start-0 border-end-0 border-top-2 border-secondary py-4">
                 <h6 class="text-white">Selenium Testing</h6>
                 <p>Learn how to start Selenium Automation Testing across multitude of desktop and mobile browsers.</p>
               </div>
               <div class="border border-bottom-0 border-start-0 border-end-0 border-top-2 border-secondary py-4">
                 <h6 class="text-white">Playwright Testing</h6>
                 <p>Conduct online Playwright Testing of your websites across 40+ browser versions.</p>
               </div>
               <div class="border border-bottom-0 border-start-0 border-end-0 border-top-2 border-secondary py-4">
                 <h6 class="text-white">Appium Testing</h6>
                 <p>Test your web and native mobile apps on Appium mobile device cloud of 3000+ real devices.</p>
               </div>
               <div class="border border-bottom-0 border-start-0 border-end-0 border-top-2 border-secondary py-4">
                 <h6 class="text-white">XCUI Testing</h6>
                 <p>Run app test automation of your iOS applications on XCUI automation cloud.</p>
               </div>
               <div class="border border-bottom-0 border-start-0 border-end-0 border-top-2 border-secondary py-4">
                 <h6 class="text-white">HyperExecute Testing.</h6>
                 <p>Learn how to leverage smart test orchestration and accelerated End-to-End Selenium test execution with HyperExecute</p>
               </div>
             </div>
      <!--    2nd group     -->
             <div>
               <div class="border border-bottom-0 border-start-0 border-end-0 border-top-2 border-secondary py-4">
                 <h6 class="text-white">Cypress Testing</h6>
                 <p>Run & analyze Cypress test scripts across 40+ browser versions on cloud.</p>
               </div>
               <div class="border border-bottom-0 border-start-0 border-end-0 border-top-2 border-secondary py-4">
                 <h6 class="text-white">Test LocalHost</h6>
                 <p>Test your locally hosted or privately hosted pages on LambdaTest platform.</p>
               </div>
               <div class="border border-bottom-0 border-start-0 border-end-0 border-top-2 border-secondary py-4">
                 <h6 class="text-white">Espresso Testing</h6>
                 <p>Automate your mobile apps on Espresso automation cloud of 3000+ real devices.</p>
               </div>
               <div class="border border-bottom-0 border-start-0 border-end-0 border-top-2 border-secondary py-4">
                 <h6 class="text-white">Test At Scale</h6>
                 <p>Explore how to use Test At Scale to expedite your testing, cut job times, and get faster feedback on code commit.</p>
               </div>
               <div class="border border-bottom-0 border-start-0 border-end-0 border-top-2 border-secondary py-4">
                 <h6 class="text-white">List of Browsers</h6>
                 <p>List of all desktop and mobile browsers available at LambdaTest platform.</p>
               </div>
             </div>
             </div>
           </section>
         </section>
      
          <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-HwwvtgBNo3bZJJLYd8oVXjrBZt8cqVSpeBNS5n7C8IVInixGAoxmnlMuBnhbgrkm" crossorigin="anonymous"></script>
        </body>
      </html>

      Browser output:

      adaptable to different

      In the output above, we have used d-flex and other classes like d-flex-column to present the various forms of automation into two columns adaptable to different screen sizes as they hit different breakpoints.

      The adaptability of the layout offers a cohesive user experience to site visitors, thus making the user more likely to spend a greater duration interacting with the website.

      See the Pen
      Bootstrap Display Property -> d-flex
      by Mbaziira Ronald (@mbaziraofug)
      on CodePen.

      Deep Diving Into Bootstrap Visibility Utility

      The Bootstrap visibility utility controls the visibility of elements without modifying their display. It has two classes, invisible and visible. The two classes are based on the CSS property of visibility, which enables hiding an element without changing the webpage layout.

      Following are the common use cases of the Bootstrap visibility utility:

      • Transitions and animations
      • CSS transitions and CSS animations enable control over the smooth and gradual change of an element’s property values and properties over a specified duration and allow the creation of features like loading spinners.

      • Overlay menus
      • This is a type of navigational menu that displays a list of options or links by covering part or all of the existing content.

      • Tooltips
      • A tooltip is a small contextual informative message that provides additional information about a particular subject when a user clicks or hovers over the element.

      <!DOCTYPE html>
      <html lang="en">
       <head>
         <meta charset="UTF-8" />
         <meta http-equiv="X-UA-Compatible" content="IE=edge" />
         <meta name="viewport" content="width=device-width, initial-scale=1.0" />
         <link
           rel="stylesheet"
           href="./node_modules/bootstrap/dist/css/bootstrap.min.css"
         />
         <title>Visibility Utility Bootstrap CSS - Invisible class</title>
       </head>
       <body>
         <p class="text-center mt-4"> <strong>Visibility Utility Bootstrap CSS - Invisible class</strong> </p>
         <div class="container">
           <p class="bg-light m-4 p-4 border-start border-5 border-primary">
             Run your Selenium test automation scripts across online Selenium Grid of
             desktop, Android and iOS mobile browsers. Develop, test, and deliver
             faster every time with automated cross browser testing using LambdaTest
             online Automation Browser Testing Grid.
           </p>
           <p class="bg-light m-4 p-4 border border-4 border-success invisible">
             Test your native hybrid of web mobile apps using LambdaTest’s online
             real device cloud and virtual mobile device platform of emulators and
             simulators. Eliminating your in-house device labs and bring high
             scalability to your mobile app testing.
           </p>
           <p class="bg-light m-4 p-4 border-top border-bottom border-5 border-info">
             Perform live interactive testing of your mobile apps on a multitude of
             Android and iOS devices. Test and debug your mobile apps faster on both
             Emulators/Simulators or online real device cloud.
           </p>
         </div>
      
      
         <script src="./node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
       </body>
      </html>

      Browser output:

      Browser output:

      As shown in the above image, we have seen that the invisible class makes the second paragraph on the web page invisible or disappears while still taking up space in the layout. We still have it in our source code, but it is visible visually.

      See the Pen
      Bootstrap CSS Visibility Utility – Invisible class
      by Mbaziira Ronald (@mbaziraofug)
      on CodePen.

      To wrap up with Bootstrap display property and visibility, the dynamic duo empowers you with a comprehensive set of tools to manage visibility and layout, creating a solid foundation for crafting responsive websites. Thus, in our next section, we will see some of the responsive layout techniques you can achieve with Bootstrap display and visibility.

      Responsive Layout Techniques with Bootstrap Display and Visibility

      We will look at the techniques you can use for Bootstrap visibility utility and Bootstrap display property to create web pages that adapt effectively to ensure a seamless user experience across different screen sizes and devices. Below are some of them;

      • Element reordering: Element reordering is a responsive layout technique that involves rearranging the order of elements in the user interface from the one in the HTML Markup to make the elements adapt better to different screens and devices or the UI more captivating.
      • It also improves the readability of the content by changing its flow, which enables users to consume information more reasonably. To achieve element reordering, you can use the Bootstrap display properties – d-flex and order-* classes.

      • Web image handling: This refers to optimizing, manipulating, and managing images for use on the web. It involves executing ways that improve a website’s responsiveness, user experience, and performance.
      • Multi-column layout: Multi-column layouts refer to a technique where content is organized into multiple columns, providing a structured and efficient way to present information.

      To demonstrate one of the responsive layout techniques, we will use the multi-column layout technique in our demo website. We will divide the content into two or more vertical columns. This will allow for a more balanced distribution of information, especially as we deal with lengthy text or numerous items.

      The Bootstrap display property classes of d-flex, flex-column, gap-*, and flex-md-column are some of the classes we will use.

      <!DOCTYPE html>
      <html lang="en">
        <head>
          <meta charset="UTF-8">
          <meta http-equiv="X-UA-Compatible" content="IE=edge">
          <meta name="viewport" content="width=device-width, initial-scale=1.0">
          <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9" crossorigin="anonymous">
          <title>Responsive page with Bootstrap Visibility and Display Property</title>
          <style>
            body::before {
              display: block;
              content: '';
              height: 100px;
            }
      
             .enterprise {
              background: linear-gradient(91.42deg,#2b56f3 18.38%,#a505d8 62.2%);
              -webkit-background-clip: text;
              -webkit-text-fill-color: transparent;
            }
            
            .img {
              height: auto;
              width: 400px;
            }
            
            .icon {
              height: auto;
              width: 55px;
            }
          </style>
        </head> 
        <body class="bg-light">
          <nav class="navbar navbar-expand-lg bg-white py-4 fixed-top">
            <div class="container ms-auto">
              <a class="navbar-brand" href="#">
                <img src="https://www.lambdatest.com/resources/images/logos/logo.svg" alt="LambdaTest Logo" />
              </a>
      
              <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar-menu">
                <span class="navbar-toggler-icon"></span>
              </button>
      
              <div class="collapse navbar-collapse" id="navbar-menu">
                <ul class="navbar-nav ms-auto">
                  <li class="nav-item"><a href="" class="nav-link">Platform</a></li>
                  <li class="nav-item"><a href="" class="nav-link">Enterprise</a></li>
                  <li class="nav-item"><a href="" class="nav-link">Resources</a></li>
                  <li class="nav-item"><a href="" class="nav-link">Developers</a></li>
                  <li class="nav-item"><a href="" class="nav-link">Pricing</a></li>
                  <li class="d-flex gap-3 ms-lg-4 ms-md-0 ms-sm-0">
                    <a href="" class="nav-link">Login</a>
                    <!-- Modal trigger -->
                    <button class="btn btn-outline-dark" data-bs-toggle="modal" data-bs-target="#bookdemo" type="button">
                      Book a Demo
                    </button>
                    <!-- Modal trigger end -->
                    <a class="btn btn-dark" href="#" role="button">Sign Up</a>
                  </li>
                </ul>
              </div>
            </div>
          </nav>
          <!--  -->
      <!--     Secttion 1 -->
         <section class="text-center py-5 container">
            <h1 class="fw-bolder display-4">Digital Experience Testing Cloud <br/> Built  For <span class="enterprise">Enterprises</span></h1>
            <p class="text-secondary lead">Our Unified Testing Cloud enables you to deliver <br/> world class digital experience with quality releases and help accelerate your release velocity.</p>
          </section>
      <!--  section 2    -->
         <section class="bg-white py-5">
           <div class="container">
             <div class="d-flex align-items-center gap-5">
             <div class="px-3 px-md-2 px-lg-5 px-sm-2">
               <h2 class="display-6 fw-bold">Real Device Cloud To Test Mobile Experience</h2>
               <p class="lead">LambdaTest's Real Devices Testing Cloud, enables you to test unhandled errors, UI/UX, performance, and functionality of your apps even before they get released into production. Test on widest range of mobile and OTT devices <span class="fw-bold">(iOS, Android, iPad, Amazon Fire TV, Roku TV & Apple TV).</span> 
      
      </p>
             </div>
             <img class="img d-none d-sm-none d-md-none d-lg-block d-xl-block d-xxl-block" src="https://www.lambdatest.com/resources/images/real_device_cloud_ep.webp" alt="">
           </div>
      <!--    Div 2     -->
           <div class="pt-3 d-flex align-items-center gap-5">
             <div class="px-3 px-md-2 px-lg-5 px-sm-2 order-1">
               <h2 class="display-6 fw-bold">Continuous Testing Cloud For Quality Digital Experience</h2>
               <p class="lead">LambdaTest's Continuous Testing Cloud allows enterprises to rapidly test and deploy changes to their web and mobile applications up to 70% faster, which helps to accelerate development process and improve time-to-market.</span> 
      </p>
             </div>
             <img class="img d-none d-sm-none d-md-none d-lg-block d-xl-block d-xxl-block" src="https://www.lambdatest.com/resources/images/browser_image.webp" alt="">
           </div>
      <!--    Div 3     -->
           <div>
             <div class="pt-3 d-flex align-items-center gap-5">
             <div class="px-3 px-md-2 px-lg-5 px-sm-2">
               <h2 class="display-6 fw-bold">Deliver Visually Perfect Digital Experience</h2>
               <p class="lead">LambdaTest's Visual Regression Cloud ensures that the visual appearance and functionality of your web applications remain consistent and error-free, ultimately improving the digital experience and business performance.</p>
             </div>
             <img class="img d-none d-sm-none d-md-none d-lg-block d-xl-block d-xxl-block" src="https://www.lambdatest.com/resources/images/visual_image.webp" alt="">
           </div>
           </div>
           </div>
         </section>
      <!--  Why Businesses Love LambdaTest section  -->
         <section class="container py-5">
           <h1 class="text-center display-6 fw-bold">Why Do Digital Businesses Love <br/> LambdaTest?</h1>
           <div class="container py-5">
             <div class="row row-cols-1 row-cols-xxl-3 row-cols-xl-3 row-cols-lg-3 row-cols-md-2 row-cols-sm-1 gy-4 gx-4">
      <!--     1      -->
               <div class="col">
                 <img class="icon" src="https://www.lambdatest.com/resources/images/multi_channel.svg" alt="">
                 <div class="pt-3">
                   <p class="h5 fw-bold">Multi-channel Support</p>
                   <p class="lead">Access our free in-product training modules, detailed support documentation, learning hub resources, connect with your dedicated account manager or leverage our 24x7 customer support to quickly get up to speed and experience our platform's full potential.</p>
                 </div>
               </div>
      <!--      2     -->
               <div class="col">
                 <img class="icon" src="https://www.lambdatest.com/resources/images/powerful_integrations.svg" alt="">
                 <div class="pt-3">
                   <p class="h5 fw-bold">Powerful Integrations</p>
                   <p class="lead">From CI/CD, project management, codeless automation to test management and reporting tools, we've got them all. Our 120+ out-of-the-box integrations will ensure increased productivity and seamless collaboration between your teams.</p>
                 </div>
               </div>
      <!--     3      -->
               <div class="col">
                 <img class="icon" src="https://www.lambdatest.com/resources/images/single_sign_on.svg" alt="">
                 <div class="pt-3">
                   <p class="h5 fw-bold">Single Sign-On</p>
                   <p class="lead">Easily enable Single Sign-On (SSO). Integrate LambdaTest with identity and access management tools Okta, Active Directory, and OneLogin to seamlessly onboard your teams.</p>
                 </div>
               </div>
      <!--      4     -->
               <div class="col">
                 <img class="icon" src="https://www.lambdatest.com/resources/images/tailor_made.svg" alt="">
                 <div class="pt-3">
                   <p class="h5 fw-bold">Tailor-made Plans to Suit Your Needs</p>
                   <p class="lead">Every business has unique requirements and we understand that. Businesses can pick and choose the features they want. No questions asked.</p>
                 </div>
               </div>
      <!--    5       -->
               <div class="col">
                 <img class="icon" src="https://www.lambdatest.com/resources/images/high_perfromance.svg" alt="">
                 <div class="pt-3">
                   <p class="h5 fw-bold">High Performance Infrastructure</p>
                   <p class="lead">Our VMs are designed to be single-use to ensure the perfect testing conditions each time. No need to depend on expensive and daunting-to-maintain in-house infrastructure anymore!</p>
                 </div>
               </div>
      <!--   6        -->
               <div class="col">
                 <img class="icon" src="https://www.lambdatest.com/resources/images/ep_insights.svg" alt="">
                 <div class="pt-3">
                   <p class="h5 fw-bold">Actionable Insights</p>
                   <p class="lead">Gain access to comprehensive reports on test runs, browser and OS coverage, platform utilization, execution logs, and videos, among others. Integrate with the analytics tool of your choice to create your own insight repo.</p>
                 </div>
               </div>
             </div>
           </div>
         </section>
      
          <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-HwwvtgBNo3bZJJLYd8oVXjrBZt8cqVSpeBNS5n7C8IVInixGAoxmnlMuBnhbgrkm" crossorigin="anonymous"></script>
        </body>
      </html>

      Mobile Preview:

      Mobile Preview

      Tablet Preview:

      Tablet Preview

      Desktop Preview:

      Desktop Preview

      The above previews show how the demo website we created responds to different devices with varying screen sizes, including mobile, tablet, and desktop previews.

      We have leveraged the LT Browser to check responsiveness, which has again come in handy when doing responsive testing on our demo website.

      See the Pen
      Responsive page with Boostrap Visibility and Display Property
      by Mbaziira Ronald (@mbaziraofug)
      on CodePen.

      Key Aspects to Consider for Bootstrap Visibility and Display

      We have looked at how Bootstrap visibility utility and Bootstrap display property work and how you can harness their capabilities to improve your website’s overall look and responsiveness.

      Nonetheless, working with these two powerful Bootstrap features comes with its challenges. Let’s look at them and how you can overcome them.

      Accessibility concerns

      When creating websites, we want them to be as accessible to as many as a wide audience as possible. According to a fact sheet by the WHO, 1.3 billion people are differently-abled, representing about 16% of the world’s population.

      However, when we use the Bootstrap display property class of d-none or d-md-none, it makes that content inaccessible to people who rely on screen readers and other assistive technologies.

      One way to address this is by using WAI-ARIA roles like aria-hidden on the element. When you set the aria-hidden role to true, the element is not only hidden visually but no longer in the accessibility tree. This improves the user experience of screen readers.

      Additionally, to take things to the next level, you can carry out accessibility testing for your website. This enables you to detect and address barriers restricting people with impairments from using your website.

      Testing responsiveness

      The ability of a website to adapt to different screen sizes and devices can mean the difference between a user buying a product, subscribing to a service, or abandoning the website. It is this vitality that responsiveness plays that makes testing the responsiveness of a website crucial.

      After making the website flexible using Bootstrap classes like d-flex, d-lg-block, and d-flex-md-row. You can do responsive testing to see how your website adapts to various screen sizes and devices. You can use tools like the LT Browser by LambdaTest, where you can simultaneously interact and test with up to six device viewports.

      Cross browser compatibility

      One other key challenge you may encounter when using Bootstrap display property and Bootstrap visibility is achieving consistency across different web browsers.

      Although Bootstrap is designed to give a uniform experience, the reality is that different browsers like Chrome, Firefox, and Safari interpret CSS and JavaScript differently. This variation can lead to inconsistencies in the behavior of elements on the web page depending on which browser the page is in view.

      The solution is to conduct browser testing to ensure your website renders as expected on different browsers. This enables you to Identify and fix any incidents. For this, you can harness an online browser farm offering cloud-based testing platforms like LambdaTest.

      It is an AI-powered test orchestration and execution platform that allows you to perform manual and automated testing of websites and mobile applications across different permutations of real browsers, devices, and platforms. And you can do all this without setting up a local test infrastructure.

      Conclusion

      In this Bootstrap tutorial Part III, we delved into Bootstrap display property and visibility utility and their examples. We have learned what classes to use and their different use cases in web development.

      Bootstrap comprehensive range of classes opens up a world of layout possibilities, ensuring that elements align and stack harmoniously across different viewport sizes.

      I encourage you to explore more possibilities you can do with Bootstrap visibility and display utilities. Thank you for taking the time to read. See you in the next one!

      Frequently Asked Questions (FAQs)

      How do I hide elements on specific screen sizes with Bootstrap?

      You can use the class formats of d-{value} and d-{breakpoint}-{value} to hide elements on specific breakpoints or screen sizes in Bootstrap.

      The d-{value} class format hides elements on the xs breakpoint while the d-{breakpoint}-{value} hides elements on the sm, md, lg, xl, and xxl breakpoints.

      What is the difference between the d-none and invisible classes in Bootstrap?

      The d-none class removes an element from the document flow entirely. The element is neither visible nor occupies space on the page. The invisible class, on the other hand, visually hides the element while preserving the space it occupies on the page.

      How do I hide text in Bootstrap?

      You can use the d-none class to hide the text entirely from the website layout. Optionally, you can use the invisible class to hide the text visually but keep the space it occupies in the layout.

      ]]>