Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      Sunshine And March Vibes (2025 Wallpapers Edition)

      May 16, 2025

      The Case For Minimal WordPress Setups: A Contrarian View On Theme Frameworks

      May 16, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      May 16, 2025

      How To Prevent WordPress SQL Injection Attacks

      May 16, 2025

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025

      Bing Search APIs to be “decommissioned completely” as Microsoft urges developers to use its Azure agentic AI alternative

      May 16, 2025

      Microsoft might kill the Surface Laptop Studio as production is quietly halted

      May 16, 2025

      Minecraft licensing robbed us of this controversial NFL schedule release video

      May 16, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      The power of generators

      May 16, 2025
      Recent

      The power of generators

      May 16, 2025

      Simplify Factory Associations with Laravel’s UseFactory Attribute

      May 16, 2025

      This Week in Laravel: React Native, PhpStorm Junie, and more

      May 16, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025
      Recent

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025

      Bing Search APIs to be “decommissioned completely” as Microsoft urges developers to use its Azure agentic AI alternative

      May 16, 2025

      Microsoft might kill the Surface Laptop Studio as production is quietly halted

      May 16, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»Driver switching from one class to another

    Driver switching from one class to another

    August 10, 2024

    In the following code, I am trying to get my driver from the class A to class B. Class B can’t have a constructor and I tried making a base class, but either Class A gets driver null or Class B gets driver null.

    Can someone point out what I am doing wrong?

    Class A :

    @Listeners(CustomListener.class)
    public class AjoutPanier {
    public WebDriver driver;

    @BeforeTest
    public void LaunchWebsite() {
    // Launch Chrome
    System.setProperty(“webdriver.chrome.driver”, “C:\chromedriver.exe”);
    driver = new ChromeDriver();
    // Acces Website
    driver.get(“https://pileouface.07zr.lu/fr/home/”);
    driver.manage().window().maximize();
    Reporter.log(FormatMessageSucces + ” Chrome is Opened</font>”);
    }…..}

    Class B :

    public class CustomListener extends AjoutPanier implements ITestListener{

    @Override
    public void onTestFailure(ITestResult result) {
    // TODO Auto-generated method stub
    System.out.println(“TestFailure acces”);
    File file = ((TakesScreenshot)b.driver).getScreenshotAs(OutputType.FILE);
    File ScreenshotName = new File(“.//ScreenShots//test.png”);
    System.out.println(“Files done”);
    try {
    System.out.println(“try”);
    FileUtils.copyFile(file, ScreenshotName);
    } catch (IOException e) {
    // TODO Auto-generated catch block
    System.out.println(“catch”);
    e.printStackTrace();
    }
    Reporter.log(“</br><img src='”+ ScreenshotName +”‘/>”);
    System.out.println(“*******Screenshot captured********”);
    }
    }

    Source: Read More

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleI streamed with Logitech’s Mevo Core camera and it almost beat my $3,600 Canon
    Next Article Parler-TTS Released: A Fully Open-Sourced Text-to-Speech Model with Advanced Speech Synthesis for Complex and Lightweight Applications

    Related Posts

    Security

    Nmap 7.96 Launches with Lightning-Fast DNS and 612 Scripts

    May 17, 2025
    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-40906 – MongoDB BSON Serialization BSON::XS Multiple Vulnerabilities

    May 17, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    Xbox Game Pass is having its most insane quarter ever — with more games than ever, and more variety than ever — but will gamers notice?

    News & Updates

    Apple’s new AI-generated ‘Genmoji’ solves a problem we’ve all had before

    Development

    Best of…: Best of 2024: Lowering the Rent Floor

    News & Updates

    Apple Intelligence Foundation Language Models

    Development

    Highlights

    Spring Sale BOGO deal: Get 2 PNY laptop SSDs for the price of 1 at Amazon

    March 28, 2025

    Need to upgrade your laptop’s storage, or looking to set up a dual-drive gaming laptop?…

    Indonesia won’t pay $8M ransom in data center attack that disrupted major public services

    June 25, 2024

    How to disable cross play in Call of Duty: Black Ops 6 and Warzone Ranked Play on console

    January 29, 2025

    CVE-2025-43561 – ColdFusion Incorrect Authorization Code Execution Vulnerability

    May 13, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.