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

      Sunshine And March Vibes (2025 Wallpapers Edition)

      June 2, 2025

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

      June 2, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      June 2, 2025

      How To Prevent WordPress SQL Injection Attacks

      June 2, 2025

      How Red Hat just quietly, radically transformed enterprise server Linux

      June 2, 2025

      OpenAI wants ChatGPT to be your ‘super assistant’ – what that means

      June 2, 2025

      The best Linux VPNs of 2025: Expert tested and reviewed

      June 2, 2025

      One of my favorite gaming PCs is 60% off right now

      June 2, 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

      `document.currentScript` is more useful than I thought.

      June 2, 2025
      Recent

      `document.currentScript` is more useful than I thought.

      June 2, 2025

      Adobe Sensei and GenAI in Practice for Enterprise CMS

      June 2, 2025

      Over The Air Updates for React Native Apps

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

      You can now open ChatGPT on Windows 11 with Win+C (if you change the Settings)

      June 2, 2025
      Recent

      You can now open ChatGPT on Windows 11 with Win+C (if you change the Settings)

      June 2, 2025

      Microsoft says Copilot can use location to change Outlook’s UI on Android

      June 2, 2025

      TempoMail — Command Line Temporary Email in Linux

      June 2, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»Unable to set proxy with BrowserMobProxy while modifying http header request in Selenium with Java

    Unable to set proxy with BrowserMobProxy while modifying http header request in Selenium with Java

    June 27, 2024

    I am able to modify http request header using BrowserMobProxy, the same way explained

    https://sqa.stackexchange.com/a/37318/9043

    But, the problem I am having at the moment is, that I am executing my scenarios on dev/local/playpen environment (environment before System integration testing). And to open the website on this environment needs proxy to set.

    When I set my proxy then it fails to modify header and apply the proxy. When I comment the proxy part then it easily modifies the header.

    BrowserMobProxy proxy = new BrowserMobProxyServer();
    proxy.start(0);
    Proxy seleniumProxy = ClientUtil.createSeleniumProxy(proxy);

    proxy.addRequestFilter((request, contents, messageInfo)->{
    request.headers().add(“some-header-attribute”, “RandomeValue”);
    System.out.println(request.headers().entries().toString());
    return null;
    });

    String _host = Utils.getConfigValue(“proxy.host”);
    String _port = Utils.getConfigValue(“proxy.port”);

    seleniumProxy.setProxyType(Proxy.ProxyType.MANUAL);
    seleniumProxy.setHttpProxy(_host + “:” + _port);
    seleniumProxy.setSslProxy(_host + “:” + _port);
    seleniumProxy.setFtpProxy(_host + “:” + _port);
    capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);

    String proxyOption = “–proxy-server=” + seleniumProxy.getHttpProxy();
    options.addArguments(proxyOption);

    Source: Read More

    Hostinger
    Facebook Twitter Reddit Email Copy Link
    Previous ArticleIs there a way to put an entire part of a request in a SoapUI variable?
    Next Article Solving the ‘Lost-in-the-Middle’ Problem in Large Language Models: A Breakthrough in Attention Calibration

    Related Posts

    Development

    A Beginner’s Guide to Graphs — From Google Maps to Chessboards

    June 2, 2025
    Development

    How to Code Linked Lists with TypeScript: A Handbook for Developers

    June 2, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    GNOME Dropping X11 Support May Complicate Next Ubuntu LTS

    Linux

    A Practical Guide to Purchase Order Systems

    Artificial Intelligence

    A new computational model can predict antibody structures more accurately

    Artificial Intelligence

    This AI Paper Explores the Theoretical Foundations and Applications of Diffusion Models in AI

    Development

    Highlights

    colored – simple Python library for color and formatting in terminal

    December 15, 2024

    colored is a simple Python library for color and formatting in terminal The post colored…

    Usability and Experience (UX) in Universal Design Series: Physical Disabilities – 1

    June 25, 2024

    Fast and accurate zero-shot forecasting with Chronos-Bolt and AutoGluon

    December 2, 2024

    The DeepSeek Tsunami: Did AI’s Big Boys Just Get Outsmarted?

    January 29, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

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