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 can’t find element in a HTML file with XPath

    I can’t find element in a HTML file with XPath

    May 14, 2024

    I am trying to get the name and the price information from this website with XPath. When i write my XPath expression down in the search bar it locates correctly in the chrome. But in VSC it doesn’t work. I get nameHtml is null error. This is the only element that has style__Text-sc-__sc-1nwjacj-0 iwTTHJ sc-dd9e2587-8 dsYcan class. Is there a problem with my expression or the code ?
    Thanks

    my code:

    public class Main {

    public static HtmlPage getDocument(String url) {
    HtmlPage page = null;
    try (final WebClient webClient = new WebClient()) {
    webClient.getOptions().setCssEnabled(false);
    webClient.getOptions().setJavaScriptEnabled(false);
    page = webClient.getPage(url);
    } catch (IOException e) {
    e.printStackTrace();
    }
    return page;
    }

    public static void main(String[] args) throws IOException {

    WebClient webClient = new WebClient();
    webClient.getOptions().setCssEnabled(false);
    webClient.getOptions().setJavaScriptEnabled(false);

    HtmlPage page = getDocument(“https://getir.com/en/category/fruits-veg-tBYm30SlS9/”);
    HtmlElement nameHtml = page.getFirstByXPath(“//div[@class = ‘style__Text-sc-__sc-1nwjacj-0 iwTTHJ sc-dd9e2587-8 dsYcan’]”);

    System.out.println(nameHtml.asNormalizedText());}

    Source: Read More

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleWhat is Workload Automation? Detailed Tutorial
    Next Article How to get content of an clickable element in Selenium?

    Related Posts

    Machine Learning

    Salesforce AI Releases BLIP3-o: A Fully Open-Source Unified Multimodal Model Built with CLIP Embeddings and Flow Matching for Image Understanding and Generation

    May 16, 2025
    Security

    Nmap 7.96 Launches with Lightning-Fast DNS and 612 Scripts

    May 16, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    WCAG 3.0’s Proposed Scoring Model: A Shift In Accessibility Evaluation

    Tech & Work

    China-Backed Hackers Leverage SIGTRAN, GSM Protocols to Infiltrate Telecom Networks

    Development

    Critical Commvault Command Center Flaw Enables Attackers to Execute Code Remotely

    Security

    Freespire – Ubuntu-based Linux distribution

    Linux

    Highlights

    Databases

    Understanding how certain database parameters impact scaling in Amazon Aurora Serverless v2

    November 25, 2024

    Amazon Aurora Serverless v2 is an on-demand, auto scaling configuration for Amazon Aurora. It automatically…

    Snowflake Warns: Targeted Credential Theft Campaign Hits Cloud Customers

    June 4, 2024

    Deblinux e il Nuovo Kernel Linux 6.13: Un Lavoro Orientato al Futuro

    January 23, 2025

    RogueGPT: Unveiling the Ethical Risks of Customizing ChatGPT

    July 27, 2024
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

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