0

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();
  • one question..I just tried it with the xpath=//div[@id='post_content1545']/h3/a - could you please have a try? For my understanding, you just tried it with the div class? Did you tried it with xpath option? – Daniel Boehm Jan 2 at 22:17
  • Yes, that is exactly the first thing I tried....I also tried with xpath and full xpath as well – Davidito Jan 2 at 22:30
  • 1
    @Davidito hi please provide the code you have tried so far – PDHide Jan 2 at 22:48
  • 1
    Hi you have to switch tab before getting the element – PDHide Jan 3 at 17:23
  • 1
    as the second page is opening in a new tab – PDHide Jan 3 at 17:29
3

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

|improve this answer|||||
1

For of all thank everyone for your help!

The answer was quite simple and I hope some of the senior members dont get mad.

In order to access the elements on the second page all I that needed to be done is switch to the correct tab.

ArrayList<String> tabs2 = new ArrayList<String>(driver.getWindowHandles());
    driver.switchTo().window(tabs2.get(1));
    //clicking the video text link on the second page 
    driver.findElement(By.xpath("/html/body/div/div/div/div/div[2]/div/div[1]/div/div[1]/span/b/a")).click();

Thanks again everyone, lesson learned!

|improve this answer|||||
  • 1
    If you ended up getting the answer from PDHide, then you should upvote and accept that answer - this is essentially a duplicate of that one. – corsiKa Jan 4 at 1:09
0

Check your selenium and chrome version. I don't think the issue is related to locator. I tried it in my local and it's working fine. I used xpath //a[text()='VIDEO']

Here's the log. At the last part, you will notice that it locates the element and click it.

pool-1-thread-1: Executing get parameters: {"url":"https://mmashare.fullfight.video/viewtopic.php?t=1545&p=1545#p1545"}

pool-1-thread-1: command: get[ param-1: {url=https://mmashare.fullfight.video/viewtopic.php?t=1545&p=1545#p1545}] Result: null

pool-1-thread-1: Executing findElement parameters: {"using":"xpath","value":"//a[text()='VIDEO']"}

pool-1-thread-1: command: findElement[ param-1: {value=//a[text()='VIDEO'], using=xpath}] Result: id: 0.6429585374922933-1

pool-1-thread-1: Executing clickElement element: By.xpath: //a[text()='VIDEO'] parameters: {"id":"0.6429585374922933-1"}

|improve this answer|||||
  • Hey Millie thanks for the help! I am using chrome verison 79.0.3945.36 which is one before that newest, curious to know which version you are using ? – Davidito Jan 3 at 4:18
  • @Davidito How about your selenium version? I'm using chrome 79.0.3945.88 – Millie Anne Volante Jan 3 at 8:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.