0

I have to perform a search repeatedly on a website (https://franklin.genoox.com/clinical-db/home) A long time ago I found the Rselenium package and I have used it successfully in previous times (After wracking my brain a lot, because I'm really new into web scrapping). The elements always were input class with a clear id (easy to find). Today I need to develop a script again that allows me to make automatic searches on this new web. But I am not able to find the correct xpath for the search bar to insert my search.

I attach an image of the search bar where I need to write. Search bar

I've tried a recommended Google Chrome extension called SelectorGadget. Supposedly it locates the xpath correctly. SelectorGadget tells me that the XPath of the search bar is this:

"//*[contains(concat( " ", @class, " " ), concat( " ", "ng-touched", " " ))]"

First, I don't know how to find this xpath by myself. When I try to "inspect" the web page and click to obtain the xpath of the search bar I obtain something really different:

My own way to obtain the xpath of the search bar

The result is: "/html/body/app-root/div/gnx-home-page/div/gnx-search/div2/input"

Can anyone explain me about this difference?

Moreover, when I try to find the Element I get an error message:

query <- remDr$findElement(using = "xpath", value = '//*[contains(concat( " ", @class, " " ), concat( " ", "ng-touched", " " ))]')

The error message is the following:

Selenium message:Unable to locate element: //*[contains(concat( " ", @class, " " ), concat( " ", "ng-touched", " " ))] For documentation on this error, please visit: https://www.seleniumhq.org/exceptions/no_such_element.html Build info: version: '4.0.0-alpha-2', revision: 'f148142cf8', time: '2019-07-01T21:30:10' System info: host: 'PORTATIL_MARIA', ip: '192.168.8.102', os.name: 'Windows 11', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_401' Driver info: driver.version: unknown

Error: Summary: NoSuchElement Detail: An element could not be located on the page using the given search parameters. class: org.openqa.selenium.NoSuchElementException Further Details: run errorDetails method

How Can I solve this problem? Why can't I find the correct XPath?

4
  • 1
    What are you trying to extract? Their API is sort of open Commented Feb 8, 2024 at 13:51
  • Thanks Hoel!. The Franklin website calculates some kind of "malignanciy score" for DNA mutations. I have a huge list of mutations to "calculate"and I wanted to do it automatically. Commented Feb 8, 2024 at 14:57
  • The xpath expression you generated is looking for the "ng-touched" classes. That is not on the element when the page loads. It's only there after you've clicked the input box. Since no clicking is occurring in the rselenium version, that's the wrong xpath. Maybe an expression like "//input[contains(@placeholder, 'Enter variant')]" would be more appropriate. Commented Feb 8, 2024 at 15:07
  • @MARIARODRIGUEZSANZ Is it the classification score you are after? Benign - Pathogenic etc.? Commented Feb 8, 2024 at 16:23

1 Answer 1

0

Try these:

  • CSS selector: .search-wrapper > input or
  • XPath: //*[@class='search-wrapper']/input.

Testing in Developer Tools both seem to work.

enter image description here

See this post for a few more details.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.