I have a table and I want to find the xpath for a button that has multiple nodes to make the difference between rest of buttons
Here is the xpath
<div id="widget-results-tabs" class="">
<ul class="widget-results-list">
<li class="widget-results-list-item">
<li class="widget-results-list-item active">
<span class="active" data-action="widgetResults">Spania</span>
<ul class="widget-results-list">
<li class="widget-results-list-item">
<li class="widget-results-list-item active">
<span class="active" data-action="widgetResults">Clasament</span>
<ul class="widget-results-list widget-results-list-dropdown">
</li>
</ul>
</li>
<li class="widget-results-list-item">
<li class="widget-results-list-item">
<li class="widget-results-list-item">
<li class="widget-results-list-item">
<li class="widget-results-list-item">
<li class="widget-results-list-item">
</ul>
</div>
I want to find the xpath for "Clasament" from "Spania"
I've tried something like this
//ul/li/span[contains(.,'Spania')]/li/span[contains(.,'Clasament')]
but it doesn't work...
Can you help me with the right xpath that will contains the condition "Spania" and condition "Clasament" ?
Try below XPath to match required li node:
//li[./span='Spania']//li[./span='Clasament']
Related
If I define my block on the li tag, TBS only shows the first item in the array.
<ul class="nav navbar-nav">
<li class="dropdown nav-item">
Logs<span class="caret"></span>
<ul class="dropdown-menu" role="menu">
<li><a class="file" href="/logs/#[logs.key; block=li]">[logs.key]</a></li>
</ul>
</li>
<li class="nav-item">Settings</li>
<li class="nav-item"><span class="navbar-text" id="grepspan"></span></li>
<li class="nav-item"><span class="navbar-text" id="invertspan"></span></li>
</ul>
If I define the block on the a tag, it shows all the items in the array.
<ul class="nav navbar-nav">
<li class="dropdown nav-item">
Logs<span class="caret"></span>
<ul class="dropdown-menu" role="menu">
<a class="file" href="/logs/#[logs.key; block=a]">[logs.key]</a>
</ul>
</li>
<li class="nav-item">Settings</li>
<li class="nav-item"><span class="navbar-text" id="grepspan"></span></li>
<li class="nav-item"><span class="navbar-text" id="invertspan"></span></li>
</ul>
What am I doing wrong here?
I have two different web pages and I want to extract some value using XPath.
What request can extract 2386028 from the first page and at the same time can extract 4019606 from the second page? I need one request that can universally extract that values.
First page fragment:
<ul class="g-ul b-properties">
<li class="b-properties__header">General</li>
<li class="b-properties__item">
<span class="b-properties__label">
<span>VendorCode</span>
</span>
<span class="b-properties__value">2386028</span>
</li>
<li class="b-properties__item">...</li>
<li class="b-properties__item">...</li>
<li class="b-properties__item">...</li>
and second page fragment:
<div class="b-properties-holder" id="tab_3">
<ul class="g-ul b-properties">
<li class="b-properties__header">General</li>
<li class="b-properties__item">
<span class="b-properties__label">
<span>Trademark</span>
</span>
<span class="b-properties__value">
<a class="link b-properties-link" href="/trademark/moist-diane/?sort=-date¤cy=USD">Moist Diane</a>
</span>
</li>
<li class="b-properties__item">
<span class="b-properties__label">
<span>VendorCode</span>
</span>
<span class="b-properties__value">4019606</span>
</li>
<li class="b-properties__item">...</li>
<li class="b-properties__item">...</li>
You can select the <li> element, which has <span class="b-properties__label">element that contains <span> with value VendorCode, and then get value of <span class="b-properties__value"> under that <li> element.
For example:
//li[span[#class="b-properties__label"]/span="VendorCode"]/span[#class="b-properties__value"]/text()
Alternatively, you can select the <span class="b-properties__label">element , which has <span> with value VendorCode, and get its following sibling.
//span[#class="b-properties__label" and span="VendorCode"]/following-sibling::span/text()
I have a application with extends a view with name "notification". How you can see in the picture.
That fragment is just a list, don't extends anything, How I pass a variable to that list? Something fixed. Any suggestion?
<li class="dropdown notifications-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="livicon" data-name="bell" data-loop="true" data-color="#e9573f"
data-hovercolor="#e9573f" data-size="28"></i>
<span class="label label-warning">7</span>
</a>
<ul class=" notifications dropdown-menu drop_notify">
<li class="dropdown-title">Você tem novas notificações</li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
#foreach($notificacao as $value)
<li>
<i class="livicon default" data-n="asterisk" data-s="20" data-c="white"
data-hc="white"></i>
Você tem novas perguntas
<small class="pull-right">
<span class="livicon paddingright_10" data-n="timer" data-s="10"></span>
{{$value->created_at->diffForHumans()}}
</small>
</li>
#endforeach
</ul>
</li>
<li class="footer">
View all
</li>
</ul>
</li>
I'm new to Selenium webdriver. Can someone help me how to make Xpath for (Flag button) on below code.
<div class="right-pan">
<ul class="right-pan-btn">
<li class="closeandtrain">
<a class="gray-color" onclick="btnChangeReviewStatusClick(3)">
<span class="statusiconclass icon-close1"/>
Close
</a>
</li>
<li>
<a onclick="btnChangeReviewStatusClick('3_1')" title="Close and train this policy">
<span class="icon-hats"/>
Close
</a>
</li>
<li class="noclassName">
<a onclick="btnChangeReviewStatusClick(4)">
<span class="flag"/>
Flag
</a>
</li>
<li>
<a onclick="btnChangeReviewStatusClick(5)">
<span class="esc"/>
Escalate
</a>
</li>
<li>
<a onclick="btnCaseClick()">
<span class="case"/>
Case
</a>
</li>
</ul>
<ul class="right-pan-links">
</div>
I tried it on Fire path that path is not working and its showing (Unable to locate element) exception
try xpath //span[#class='flag']
I am not able to comment to your post, so posting this as answer.
You can go through this link to learn about xpaths.
http://www.tizag.com/xmlTutorial/xpathtutorial.php
Can you try this
I think you should click parent of span
//span[#class='flag' and text()='Flag']/ancestor::a[1]
or
//span[#class='flag' and text()='Flag']/..
I have the top-bar nav all setup and the dropdowns are displaying as expected. However, when I click on a dropdown link, the dropdown just disappears. The page does not advance to the URI as expected.
I'm stumped...
<section class="top-bar-section second-row">
<ul>
<li class="active"><i class="fa fa-exclamation-triangle"></i><span> Alert Central</span></li>
<li class="has-dropdown">
<i class="fa fa-bar-chart"></i><span> Analytics</span>
<ul class="dropdown">
<li>System Status</li>
<li>My Use</li>
<li>My User's Use</li>
<li>Account Information</li>
</ul>
</li>
<li class="has-dropdown">
<i class="fa fa-magic"></i><span> Filter Management</span>
<ul class="dropdown">
<li>Keywords</li>
<li>Categories</li>
<li>Locations</li>
</ul>
</li>
<li class="has-dropdown">
<i class="fa fa-users"></i><span> User Management</span>
<ul class="dropdown">
<li>Users</li>
<li>Roles</li>
</ul>
</li>
</ul>
</section>
Did you try to add data-topbar in <section> tag ?
<section data-topbar class="top-bar-section second-row">