logo
down
shadow

Get Xpath for href from a tag based on span tag value


Get Xpath for href from a tag based on span tag value

By : zhigangwang315
Date : October 18 2020, 03:08 PM
hop of those help? According to your description the relevant XPath query to Get href value where span class value is "Upholstered will be something like:
code :
//a[@class='Upholstered']/@href


Share : facebook icon twitter icon
Underline all of href tag text: issues with having </span><br /><span> inside href tag

Underline all of href tag text: issues with having </span><br /><span> inside href tag


By : incredibon
Date : March 29 2020, 07:55 AM
wish helps you I have a small problem and can't figure out how to fix it. In my HTML I have an ahref tag with a "/span" tag, a line break, and a new "span" tag within it. , Update your html to :
code :
<span class="span1">
    <a href="www.google.com" target="_blank">The Google</a><br/><br/>
    <a href="www.stackoverflow.com" target="_blank">The StackOverFlow</a><br/><br/>
    <a href="www.us.gov" target=_"blank"><span>Important </span>

<br /><span class="span2"> Information</span>

</a>
</span>
XPath retrieving <a> href, text, and <span>

XPath retrieving <a> href, text, and <span>


By : Monika Dhankani
Date : March 29 2020, 07:55 AM
To fix the issue you can do I'm currently crawling some web sites and retrieving information from them to store into a database for later use. I'm using HtmlAgilityPack and I've successfully done this for a few sites now but for some reason this one is giving me issues. I'm fairly new to XPath syntax still so I'm probably messing up there. , Well I figured it out, heres the code
code :
foreach (HtmlNode node in html.DocumentNode.SelectNodes("//form[@id='_subcat_ids_']"))
{
  //get the categories, store in list
  foreach (HtmlNode node2 in node.SelectNodes("..//a[@class='facet-selection  multiselect-facets ']//text()[normalize-space() and not(ancestor::span)]"))
  {
    string tempCat = node2.InnerText.Trim();
    categoryList.Add(tempCat);
    Console.Write("\nCategory: " + tempCat);           
  }
  foreach (HtmlNode node3 in node.SelectNodes("..//a[@class='facet-selection  multiselect-facets ']"))
  {
    //get href for each category, store in list
    string tempHref = node3.GetAttributeValue("href", string.Empty);
    LinkCatList.Add(tempHref);
    Console.Write("\nhref: " + tempHref);
    //get the number of items from categories, store in list
    string tempNum = node3.SelectSingleNode(".//span[@class='subtle-note']").InnerText.Trim();
    string tp = tempNum.Replace("(", "");
    tempNum = tp;
    tp = tempNum.Replace(")", "");
    tempNum = tp;
    Console.Write("\nNumber of items: " + tempNum + "\n\n");
   }
}
Xpath grab div contents based on span class

Xpath grab div contents based on span class


By : td01
Date : March 29 2020, 07:55 AM
To fix the issue you can do You need to go back to the parent of span since the div you are looking for is a sibling of h3 not span.
There is probably a nicer way to do it but this is working for me to get the div element you need:
code :
//h3//span[contains(@class, 'panda')]/parent::h3/following-sibling::div
XPath evaluate return anchor href if span in same row contains text

XPath evaluate return anchor href if span in same row contains text


By : user2910988
Date : March 29 2020, 07:55 AM
XPath for a span based on its text?

XPath for a span based on its text?


By : Syed Omer Ali
Date : March 29 2020, 07:55 AM
hope this fix your issue I am unable to locate first span with XPath I tried: , If you want to select span with text - Edit Studen try any of this:
Related Posts Related Posts :
  • Add A Tick To Button When Selected In Angular 2 App
  • Footer position
  • Arranging elements using CSS queries
  • CSS update :after when input is checked
  • How can I scrape an embedded Google Calendar from a URL?
  • Ionic: customize toggle button.
  • How to get selected value from customized Dropdown in node.js
  • How to keep active menu item underlined?
  • I can't change the background color of the html sections
  • Logo has different height than menu nav CSS
  • Center text in col-md-4
  • How to fix display flex with percent width columns 1px gap?
  • How to design the div box with arrow by using css according to my example?
  • React.createElement: type should not be null, undefined.. When creating/rendering
  • Github pages not loading css on subfolders
  • Why are my scrollbars not appearing?
  • How to semantically mark up a pre-headline ‘kicker’ in HTML?
  • Is it okay to use !important in many elements? If not how to fix this
  • Flexbox - images overflowing instead of wrapping
  • "col" and "row" responsive
  • Background-image: Using a link to an external resource within a div
  • Count <tr> HTML tag grouped by their @class attribute name in XPath
  • Scraping html text into table with delimiters that do not have a clear pattern using R (rvest)
  • Sorting a complex Table w/nestled tables (but w/out tablesorter)
  • ElementUI : right submenu appears truncated (CSS)
  • Bigger logo without affecting other elements in the navbar
  • Centered Navigation -- Sub Menus are Off-Center
  • Decoding a combination of windows-1252 and quoted printable HTML
  • WebStorm HTML formatting error - Expecting newline or semicolon
  • color overlay on a div behavior
  • Footer not displaying at bottom of page
  • Page body does not extend to bottom of display when zooming out
  • Materialize- A Dropdown inside a tab
  • Bootstrap 4 jacked up on IE 10
  • Overlay Static Images on R Leaflet htmlwidget
  • document setAttribute ngModel Angular
  • web-design: WHY doesn't :before scss work nested inside li unless I put it seperated?
  • Can't get first instance of CSS element to line up correctly
  • Image with strange Padding within Table
  • Why can't i add a new slide to my pure css slideshow?
  • ColdFusion convert hidden form variables to a structure
  • Corner DIV with transparent filling
  • CSS :before width
  • How to combine many CSS animation nth-of-type selectors into one?
  • Vertical-align play button with mobile navbar-button
  • VBA - Navigating HTML table with IF function
  • Grid properties not working on elements inside grid container
  • Bootstrap4-styled <select> element rendering incorrectly
  • Adding an element to the DOM with Chrome developer tooling?
  • Div Appearing over Heading
  • How to Have Google Not Show Recent Inputs
  • What's the state of OffscreenCanvas's support for 2d context?
  • Can't find a way to correct my input text box
  • Flexbox order property not working to order elements?
  • visibility: visible not working
  • CSS ul li with display:inline-block but position is wrong
  • How to make my user's blogs visible in search engines?
  • How to change the order of ancestors of flex child elements
  • Bootstrap navbar toggler icon (hamburger) size
  • How to make a drop down menu from an icon in a navbar?
  • shadow
    Privacy Policy - Terms - Contact Us © soohba.com