Answer the question
In order to leave comments, you need to log in
How to find the desired element on the page?
Good afternoon.
There is this piece on the page:
General
Friends 311
Photos 210
Groups 14
Games 0
With the following code:
<div id="hook_Block_MiddleColumnTopCard_MenuFriend" class="hookBlock"><div class="mctc_navMenu ">
<a hrefattrs="st.cmd=friendMain&st.friendId=1111111&st._aid=NavMenu_Friend_Main" href="/profile/1111111" class="mctc_navMenuSec">Основное</a>
<a hrefattrs="st.cmd=friendFriend&st.friendId=1111111&st._aid=NavMenu_Friend_Friends" href="/profile/1111111/friends" class="mctc_navMenuSec">Друзья <span class="navMenuCount">311</span></a>
<a hrefattrs="st.cmd=friendPhotos&st.friendId=1111111&st._aid=NavMenu_Friend_Photos" href="/profile/1111111/photos" class="mctc_navMenuSec mctc_navMenuActiveSec">Фото <span class="navMenuCount">210</span></a>
<a hrefattrs="st.cmd=friendAltGroup&st.friendId=1111111&st._aid=NavMenu_Friend_AltGroups" href="/profile/1111111/groups" class="mctc_navMenuSec">Группы <span class="navMenuCount">14</span></a>
<a hrefattrs="st.cmd=friendApps&st.friendId=1111111&st._aid=NavMenu_Friend_Apps" href="/profile/1111111/games" class="mctc_navMenuSec">Игры <span class="navMenuCount">0</span></a>
Answer the question
In order to leave comments, you need to log in
Try:
driver.findElement.byCSSSelector("a[href*='photos']")
I already forgot how in Python, but I think the meaning is clear
In Java, I would
write @FindBy(css="a[href*='members ']") private WebElement navMenuPhotos;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question