title: How to fix 403 response when using HttpURLConnection in Selenium since the links are opening manually without any issue
body: <p>I was checking the active links in a website with selenium web driver and java. I have passed the links to the array and while verifying I am getting the response as 403 forbidden for all links in the site. It is just a public website anyone can access. The links are working properly when clicking manually. I wanted to know Why it is not showing 200 and what can be done on this situation.</p>
  
  <p>This is for Selenium webdriver with Java</p>
  
  <pre><code>for(int j=0;j&lt; activelinks.size();j++) {
          System.out.println("Active Link address and status &gt;&gt;&gt; " +  activelinks.get(j).getAttribute("href"));
          HttpURLConnection connection = (HttpURLConnection)new URL(activelinks.get(j).getAttribute("href")).openConnection();
          connection.connect();
          String response = connection.getResponseMessage();
          int responsecode = connection.getResponseCode();
          connection.disconnect();
          System.out.println(activelinks.get(j).getAttribute("href")+ "&gt;&gt;"+ response+ " " + responsecode);}
  </code></pre>
  
  <p>I expect the response code as 200, but the actual output is 403</p>