K
K
ksvdon2014-12-04 17:55:50
HTML
ksvdon, 2014-12-04 17:55:50

How to do search in html page using selenium?

I'm asking a question so as not to reinvent the wheel. There is a web page with a window where there are records that some users have shown activity. I need to check whether active users are displayed in the web interface or not. With the help of Firebux, I find a tag that contains a description tag of what will be displayed (username id and all that) and tags appear below that record about the user and his settings if the user has shown activity. It looks something like this:

<tbody id="topbody">
<tr> (постоянный тег, в котором описание того что будет выводиться)
<tr class="odd"> появляется, если 1 пользователь проявил активность
<tr class="even"> появляется если ещё 1 пользователь проявил активность (в тегах, которые появляются только во время активности - конкретные значения, которые отображаются под тегом описания смысла этих значений "tr")
</tbody>

if there is no activity, then it looks like this
<tbody id="topbody">
<tr> (постоянный тег, в котором описание того что будет выводиться)
</tbody>

I need to check that user1 is let's say active (displayed on the page). But the tag with the text user1 will only appear during activity. Those. I can't prepare xpath in advance for something that doesn't exist. Of course, in principle, you can search for "By.name", but I need the search to go exactly within the tag
<tbody id="topbody">
</tbody>

tell me where such things are described or in 2 words how best to do such a search?
I will do it in selenium webdriver.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Blokhin, 2015-02-15
@TITnet

If you need to search within a tag, then you should do this (Ruby example):

parent = driver.find_element :id, 'topbody'
child = parent.find_element :class, 'odd'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question