I can't capture with findElement the class, xpath etc. in:

  1. https://economia.estadao.com.br/noticias/geral,por-que-nao-tres-em-uma,70002648617
  2. click on: entre aqui para ler a matéria.

I already tried several ways.

My code is

public static void main(String[] args) {
    WebDriver navegador = new FirefoxDriver();  
    navegador.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); 

enter image description here

  • What ways? What happened? Give an actual example.
    – jonrsharpe
    Mar 5 '19 at 21:49
  • Hi Jon, Please, I need to access the site economia.estadao.com.br/noticias/… and to click on: "entre aqui para ler a matéria".
    – saulik
    Mar 5 '19 at 21:53
  • Yes, I understood that from the question. It's unclear what problem you've had in trying to implement that.
    – jonrsharpe
    Mar 5 '19 at 21:54

Try this Xpath

//b[contains(text(),'entre aqui para ler a matéria ')]

This will work.


Since the text is within the a tag, the following will work:


  • Hi Friends, I'm trying but without success. For now I thank you very much. If someone wants to access the site and try to capture I'm happy. But I'll try the solutions you sent.
    – saulik
    Mar 7 '19 at 14:58
  • Hi Friends I've tried every possible command, I've honestly never seen anything like it. I have even used advanced commands from the site saucelabs.com/resources/articles/selenium-tips-css-selectors and I did not succeed. If anyone can, I'll pay for lunch, but for me, that's enough !! The path to this is: economia.estadao.com.br/noticias/… and click on: entre aqui para ler a matéria Very grateful to all who tried to help me !.
    – saulik
    Mar 8 '19 at 21:21

Most modern browsers support developer mode. Use "inspector" to copy xpath of the element you are interested in. For your example:

  • 2
    This kind of xpath locator use is bad practice, and why xpath has a reputation of being terrible in the test automation community. Using an absolute xpath of this length has a high probability of breaking with any HTML change.
    – anonygoose
    Mar 7 '19 at 12:56
  • Right, but still valid and easy way to get started.
    – codach
    Mar 7 '19 at 14:47

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.