lundi 5 octobre 2015

Find a text with multiple lines and selenium webdriver. Using driver.pageSource().contains

Hello I need to know how find a text in a website in when it is in multiple lines, using selenium webdriver, for example this scenario:

I have this piece of code in my html:

<div class="record-label" data-name="age_child1_c">
     LBL_AGE_CHILD
</div>

For example if i code:

driver.pageSource().contains("LBL_AGE_CHILD")

Selenium is able to locate that line perfecty.

But I need to locate this pattern:

">LBL_"

However > and LBL_ are in different lines.

I tried it using \n:

driver.pageSource().contains(">\nLBL_")

But it didn't work, Anyone knows how can i locate that pattern being two strings in different lines? I have this piece of code in my html:

<div class="record-label" data-name="age_child1_c">
     LBL_AGE_CHILD
</div>

For example if i write:

driver.pageSource().contains("LBL_AGE_CHILD")

Selenium is able to locate that line perfecty.

But I need to locate this pattern:

">LBL_"

However > and LBL_ are in different lines.

I tried it using \n:

driver.pageSource().contains(">\nLBL_")

Hello I need to know how find a text in a website in when it is in multiple lines, using selenium webdriver, for example this scenario:

I have this piece of code in my html:

<div class="record-label" data-name="age_child1_c">
     LBL_AGE_CHILD
</div>

For example if i write:

driver.pageSource().contains("LBL_AGE_CHILD")

Selenium is able to locate that line perfecty.

But I need to locate this pattern:

">LBL_"

However > and LBL_ are in different lines.

I tried it using \n:

driver.pageSource().contains(">\nLBL_")

But it didn't work, Anyone knows how can i locate that pattern if two strings in different lines?

Aucun commentaire:

Enregistrer un commentaire