Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6686233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:08:55+00:00 2026-05-26T05:08:55+00:00

I saw the other questions regarding similar/same issues but they did not help me

  • 0

I saw the other questions regarding similar/same issues but they did not help me solve the problem :(. I log into the production site . say ( http://www.site.com/log) . I want to click on a link after that but Selenium is not able to find the link. The relevant HTML part is :

<div style="display:none" id="managers">
             <a class="projectManager" style="color:black"> Project Manager</a>

             <a class="transportManager"> Transport Manager</a>
         </div>

The java code is below:

import java.util.regex.Pattern;
import java.util.concurrent.TimeUnit;
import org.junit.*;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.Select;

public class test {
    private WebDriver driver;
    private String baseUrl="";
    private StringBuffer verificationErrors = new StringBuffer();
    @Before
    public void setUp() throws Exception {
        //driver = new FirefoxDriver();
        //driver.manage().timeouts().implicitlyWait(45, TimeUnit.SECONDS);
        DesiredCapabilities chromeCapabilities = DesiredCapabilities.chrome();

        String chromeBinary = System.getProperty(" ");
        if (chromeBinary == null || chromeBinary.equals("")) {
            String os = System.getProperty("os.name").toLowerCase().substring(0, 3);
            chromeBinary = "lib/chromedriver-" + os + (os.equals("win") ? ".exe" : "");
            System.setProperty("webdriver.chrome.driver", chromeBinary);
        }
        driver=new ChromeDriver(chromeCapabilities);
        driver.manage().timeouts().implicitlyWait(70,TimeUnit.SECONDS);
    }

    @Test
    public void testEmployee() throws Exception {
        driver.get("http://www.site.com/log");
        driver.findElement(By.name("j_username")).clear();
        driver.findElement(By.name("j_username")).sendKeys("username");
        driver.findElement(By.name("j_password")).clear();
        driver.findElement(By.name("j_password")).sendKeys("password");
        driver.findElement(By.cssSelector("input[name=\"login\"]")).click();
        Thread.sleep(10000);

        driver.findElement(By.linkText(" Project Manager")).click();
        driver.findElement(By.linkText("Sign Out")).click();
        System.out.println("Test done");
        }
    @After
    public void tearDown() throws Exception {
        driver.quit();
        String verificationErrorString = verificationErrors.toString();
        if (!"".equals(verificationErrorString)) {
            fail(verificationErrorString);
        }
    }

    private boolean isElementPresent(By by) {
        try {
            driver.findElement(by);
            return true;
        } catch (NoSuchElementException e) {
            return false;
        }
    }
}

Question: What is the error ? It gives an “element not found” exception

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:08:55+00:00Added an answer on May 26, 2026 at 5:08 am

    Try using the following..

    driver.findElement(By.partialLinkText(" Project Manager")).click();
    driver.findElement(By.partialLinkText("Sign Out")).click();
    

    Hope this works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I saw some other similar questions on this topic here but they were not
I saw the other questions about the subject but all of them were missing
I saw plenty of similar questions on SO but hardly any of them have
I saw the other topic and I'm having another problem. The process is starting
I saw other questions dealing with the finding the n-th occurrence of a word/pattern,
I know there are other naming convention discussions, but the ones I saw were
I saw other questions about libraries to create timelines with Javascript. There are some
Let me preface by saying that I saw this other question on the subject
The other day I saw a colleague of mine using sort to sort a
The other day I saw an application with a branching options menu . I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.