1

I'm trying to identify the element. I want to identify the "address your concerns.". I am able to reach up to div tag but i need to reach the text in the div tag.

HTML:

<span class="Linkify">
    <div>
        <div>
            address your concerns. 
        </div> 
    </div>
</span>

I am trying to identify the text "address your concerns" so can anyone help me with this in chrome browser, I am trying?

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
mack
  • 13
  • 5

2 Answers2

0

Try doing it using XPath to locate your div element, something like this "//span[@class='Linkify']/div/div" and then use getText() method on this div to get your text.

Dooms_day
  • 21
  • 5
  • //span[@class='Linkify']/div/div[contains(text(), 'address your dry eye concerns.')] I need without using getText()method with this can able to reach upto second div tag – mack Jun 18 '20 at 09:29
0

To identify the element using Selenium you need to induce WebDriverWait for the visibilityOfElementLocated() and you can use either of the following Locator Strategies:

  • cssSelector:

    WebElement cssElement = new WebDriverWait(driver, 20).until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("span.Linkify > div > div")));
    
  • xpath:

    WebElement xpathElement = new WebDriverWait(driver, 20).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[@class='Linkify']/div/div[contains(., 'address your concerns')]")));
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352