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»I am getting this.driver” is null , Would you be able to help and what should be fixed?

    I am getting this.driver” is null , Would you be able to help and what should be fixed?

    December 20, 2024

    java.lang.NullPointerException: Cannot invoke “org.openqa.selenium.WebDriver.quit()” because “this.driver” is null
    at hooks.MyHook.teardown(MyHook.java:24)

    public class MyHook extends Base{   
            @Before
            public void beforeScenario(){
            System.out.println("Scenarios has started");
            }
            @After
            public void teardown()  {
            driver.quit();
            }   
    }
    
    public class Base {
        public WebDriver driver;
        public Properties prop;
        
        public WebDriver initializeDriver() throws IOException{
        prop= new Properties();
        FileInputStream fis=new FileInputStream("C:\Users\CITPL-Developer-2\eclipse-workspace\Fdms\src\main\java\citpl\resources\data.properties");
        prop.load(fis);
        
        String browserName = System.getProperty("browser")!=null ? System.getProperty("browser") :prop.getProperty("browser");
        
        if(browserName.equals("chrome"))
        {
            ChromeOptions options = new ChromeOptions();
            options.addArguments("--remote-allow-origins=*");
            System.setProperty("webdriver.chrome.driver","C:\Users\CITPL-Developer-2\driver\chromedriver.exe");
    
            if(browserName.contains("headless")){
            options.addArguments("headless");
            }       
            driver = new ChromeDriver(options);
            driver.manage().window().maximize();
        }
        driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
        return driver;
        }
    
    public class LoginSteps extends Base{
    
        @Given ("Naviagate to the login page")
        public void Naviagate_to_the_login_page() throws IOException {
            initializeDriver();
            driver.get(prop.getProperty("url"));
        }
        @When ("^I enter valid username (.+) and password (.+)$")
        public void I_enter_valid_username_valid_username_and_Pasword(String username, String password) throws InterruptedException {
            LoginPage lp= new LoginPage(driver);
            lp.entervalidCredentials(username, password);
        }
    

    Source: Read More

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleAppium2 + iOS app : Appium inspector is not loading to inspect elements for iOS after upgrading to macOS Sequoia
    Next Article Slim-Llama: An Energy-Efficient LLM ASIC Processor Supporting 3-Billion Parameters at Just 4.69mW

    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

    Google AI Introduces Learn-by-Interact: A Data-Centric Framework for Adaptive and Efficient LLM Agent Development

    Machine Learning

    Restic Browser is a simple restic backup GUI

    Linux

    Enable or Disable Word Wrap in VS Code

    Linux

    Prabhu Technology

    Development

    Highlights

    Development

    Linux io_uring PoC Rootkit Bypasses System Call-Based Threat Detection Tools

    April 24, 2025

    Cybersecurity researchers have demonstrated a proof-of-concept (PoC) rootkit dubbed Curing that leverages a Linux asynchronous…

    Best Free and Open Source Alternatives to MSN Weather

    May 8, 2025

    This Yamaha soundbar delivers audio quality that competes with systems twice its price

    May 8, 2025

    Can you watch movies on your TV using a USB stick? You most certainly can

    April 21, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

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