Selenium un-enable to find element



  • I have been through every selenium related page on here but not much else I can really try.

    I am trying to click on the text link but It gives me 'org.openqa.selenium.WebDriverException: chrome not reachable'

    I have tried finding the element by: xpath csselector etc

    There are no frames in this particular html page so it cant be an issue of switching frames.

    I have tried getting by tagname("a") also div class "content" then search elements inside but to no avail.

    <div class="content"><br><span style="font-size:20px"><b><a href="https://mmashare.fullfight.video/viewtopic.php?f=36&amp;t=1544">VIDEO</a></b></span><div class="responsive-show" style="display:none"><style type="text/css">
    

    This is the html page in full.

    https://mmashare.fullfight.video/viewtopic.php?t=1545&p=1545#p1545

    Ps this is not my homework I would appreciate any ideas.

    Thanks in advance guys.

    Update:

    here is the code I have I am currently trying

    WebDriver driver = new ChromeDriver();
        driver.manage().window().maximize();
        String url = "https://mmashare.fullfightvideo.eu/";
        driver.get(url);
        String li = "";
    
            Thread.sleep(15 * 1000);
            //https://mmashare.fullfightvideo.eu/ that clicks on first link
            // and sends user to second page
            driver.findElement(By.xpath("/html/body/div[4]/div[2]/div[2]/div[2]/div[2]/div[2]/div[2]/div/div[4]/div[1]/div/div/div[2]/div[1]/span[1]/strong/span/div/ul/li[1]/span/a")).click();
    
            Thread.sleep(15 * 1000);
            //clicking the video text link on the second page https://mmashare.fullfight.video/viewtopic.php?t=1545&p=1545#p1545
            driver.findElement(By.xpath("/html/body/div/div/div/div/div[2]/div/div[1]/div/div[1]/span/b/a")).click();
    


  • It seems the second page is opening in a new tab, please switch the tab before interacting with the page:

    driver.findElement(By.xpath("/html/body/div[4]/div[2]/div[2]/div[2]/div[2]/div[2]/div[2]/div/div[4]/div[1]/div/div/div[2]/div[1]/span[1]/strong/span/div/ul/li[1]/span/a")).click();
    ArrayList<String> tabs = new ArrayList<String>(driver.getWindowHandles());
    driver.switchTo().window(tabs.get(1));
    Thread.sleep(15 * 1000);
    
                //clicking the video text link on the second page https://mmashare.fullfight.video/viewtopic.php?t=1545&p=1545#p1545
    driver.findElement(By.xpath("/html/body/div/div/div/div/div[2]/div/div[1]/div/div[1]/span/b/a")).click();
    driver.close();   
    
    //To switch back
        driver.switchTo().window(tabs.get(0));
    

    Note: Just print the tabs variable and see the content to switch properly



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2