This is my docker file # Base image with Maven and JDK FROM maven:3.8.4-openjdk-11 # Set the working directory in the container WORKDIR /app # Install necessary dependencies RUN apt-get update -y && apt-get install -y \ wget \ xvfb \ curl \ unzip \ jq \ libxss1 \ libappindicator1 \ libgconf-2-4 \ fonts-liberation \ libasound2 \ libnspr4 \ libnss3 \ libx11-xcb1 \ libxtst6 \ lsb-release \ xdg-utils \ libgbm1 \ libatk-bridge2.0-0 \ libgtk-3-0 \ libxcb-dri3-0 \ libgl1-mesa-glx \ libxrender1 \ libxcomposite1 \ libxi6 \ libxrandr2 \ libxcursor1 \ libxinerama1 # Download versions JSON and install Google Chrome RUN curl -s https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json > /tmp/versions.json && \ CHROME_URL=$(jq -r '.channels.Stable.downloads.chrome[] | select(.platform=="linux64") | .url' /tmp/versions.json) && \ wget -q --continue -O /tmp/chrome-linux64.zip $CHROME_URL && \ unzip /tmp/chrome-linux64.zip -d /opt/chrome && \ chmod +x /opt/chrome/chrome-linux64/chrome # Install ChromeDriver RUN CHROMEDRIVER_URL=$(jq -r '.channels.Stable.downloads.chromedriver[] | select(.platform=="linux64") | .url' /tmp/versions.json) && \ wget -q --continue -O /tmp/chromedriver-linux64.zip $CHROMEDRIVER_URL && \ unzip /tmp/chromedriver-linux64.zip -d /opt/chromedriver && \ chmod +x /opt/chromedriver/chromedriver-linux64/chromedriver # Set environment variables ENV CHROME_BIN /opt/chrome/chrome-linux64/chrome ENV CHROMEDRIVER_DIR /opt/chromedriver ENV PATH $CHROMEDRIVER_DIR:$PATH ENV DISPLAY=:99 # Clean up RUN rm /tmp/chrome-linux64.zip /tmp/chromedriver-linux64.zip /tmp/versions.json # Default command to run tests CMD ["sh", "-c", "Xvfb :99 -ac & mvn clean test -Dwebdriver.chrome.driver=/opt/chromedriver/chromedriver-linux64/chromedriver -Dwebdriver.chrome.whitelistedIps='' -Dchrome.options.args='--headless --disable-gpu --no-sandbox --disable-dev-shm-usage --remote-allow-origins=* --disable-software-rasterizer --disable-features=VizDisplayCompositor'"]
Context: I am using the above docker image inside my azure pipleine as container to run java selenium test cases.
Error:
no such element: Unable to locate element: {"method":"xpath","selector":"//a[@href='ExcelDataListOverall.asp']"} (Session info: chrome=129.0.6668.70) For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception Build info: version: '4.11.0', revision: '040bc5406b' System info: os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-1160.119.1.el7.x86_64', java.version: '11.0.14.1' Driver info: org.openqa.selenium.chrome.ChromeDriver Command: [62eccac0565dae1b9e5321e8200627f3, findElement {using=xpath, value=//a[@href='ExcelDataListOverall.asp']}] Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 129.0.6668.70, chrome: {chromedriverVersion: 129.0.6668.70 (df87d5cf12b1..., userDataDir: /tmp/.org.chromium.Chromium...}, fedcm:accounts: true, goog:chromeOptions: {debuggerAddress: localhost:41060}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: linux, proxy: Proxy(), se:cdp: ws://localhost:41060/devtoo..., se:cdpVersion: 129.0.6668.70, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:extension:minPinLength: true, webauthn:extension:prf: true, webauthn:virtualAuthenticators: true} Session ID: 62eccac0565dae1b9e5321e8200627f3
Issue faced:
But that href element is getting launched when i run from my machine or from other windows server. I have increased timeout as well it is not working. And when i took snapshots of that i could that specific element is not loaded at all.**
Tested multiple way but failing. Any idea upon this**