I am trying to execute a Selenium script to login to Jira cloud and performing some actions using Selenium in Chrome( in headless mode). I was able to do the same from my local. But when trying to put the script in Jenkins, it is not reaching the login page and when checking the page source it is giving an error like
<div class="scriptLoadError"> <div class="container"> <h1 class="logo">Atlassian</h1> <div class="heading">JavaScript is disabled</div> <div class="content"> <p>**You should enable JavaScript to work with this page.</p> </div> </div> </div> </noscript> <div id="javaScriptLoadError" style="display: block;"> <div class="scriptLoadError"> <div class="container"> <h1 class="logo">Atlassian</h1> <div class="heading">JavaScript load error</div> <div class="content"> <p>We tried to load scripts but something went wrong.</p> <p> Please make sure that your network settings allow you to download scripts from the following domain: </p> <p><b>https://aid-frontend.prod.atl-paas.net</b></p> <**/div> </div> </div> </div> </div> <script type="module" src="https://aid-frontend.prod.atl-paas.net/atlassian-id/front-end/5.0.541/index.d06a7c6e.js" crossorigin="anonymous"></script><script src="https://aid-frontend.prod.atl-paas.net/atlassian-id/front-end/5.0.541/index.141ede18.js" nomodule="" defer="" crossorigin="anonymous"></script> <script nonce="">window.onload=function(){if(document.getElementById("javaScriptLoadError"))throw document.getElementById("javaScriptLoadError").style.display="block",Error("Javascript load error screen displayed to user")};</script> </body></html>
I tried used different options to fix this( detailed below). But nothing is working
# Set Chrome options
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument(f"user-agent={user_agent}")
chrome_options.add_argument("--disable-gpu") # Disable the GPU to avoid graphical issues
chrome_options.add_argument("--disable-web-security") # Disable web security to disable CORS
chrome_options.add_argument("--window-size=1920,1080")
chrome_options.add_argument("--disable-extensions")
chrome_options.add_argument("--proxy-server='https://'")
chrome_options.add_argument("--proxy-bypass-list=*")
chrome_options.add_argument("--start-maximized")
chrome_options.add_argument('--disable-gpu')
chrome_options.add_argument('--disable-dev-shm-usage')
chrome_options.add_argument('--ignore-certificate-errors')
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--headless=new")
chrome_options.add_argument("--incognito")
chrome_options.add_argument("--disable-popup-blocking") # Disable pop-up blocking
chrome_options.add_argument("--log-level=3")
prefs = {}
prefs["webkit.webprefs.javascript_enabled"] = True
prefs["profile.content_settings.exceptions.javascript.*.setting"] = 1
prefs["profile.default_content_setting_values.javascript"] = 1
prefs["profile.managed_default_content_settings.javascript"] = 1
chrome_options.add_experimental_option("prefs", prefs)
chrome_options.add_argument("--enable-javascript")
chrome_options.enable_downloads = True
# Initialize the WebDriver with Chrome options
driver = webdriver.Chrome(options=chrome_options)
driver.get('https://jira_cloud_url')
Is this due to some network config issues from Jenkins or some other settings missing. Any pointers will be appreciated.