Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm using webBrowser control in winform app C# FW4.0, and I would like to find all the elements that their class attribute contains some value. Is it possible?
You can do this, but it will take some work on your own.
An example on how to find all a tags with class show1 should help you find what you need. Here is an excerpt from the example there
var links = webBrowser1.Document.GetElementsByTagName("a");
foreach (HtmlElement link in links)
{
if (link.GetAttribute("class") == "show1")
{
//do something
}
}
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I want to create application in WPF wchich will scrape information from webpage
I read link to the page from text box at the top
I want to extract company name from h6
I don't understand that format:"//h2[#class='card__title mdc-typography--headline6']". I could't find documentation abot meaning # [] etc. to create another filters to scrape other data for example phone number from tag.
The #, //, ... represent abbreviated syntax for XPath selectors.
#abc is short for attribute::abc
// is short for /descendant-or-self::node()/
So, in other terms, your current query //h2[#class='card__title mdc-typography--headline6'] represents the action of finding the first descendant- or self-node that has a class attribute of card__title mdc-typography--headline6.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I want to call every form that exist in the Program/Project,
As i say in the title literally
foreach(Form){
//do somting
}
You can iterate all open forms owned by your application like this:
foreach (Form form in Application.OpenForms){
//do your thing
}
Note: this will only iterate the forms that have instances created.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I have a random text, which can include special (for sendkeys) symbols like ), ( etc (obvious book, for example). Screening unsuitable too, becouse string send through the internet, so the size of string important. Can you suggest some decision?
Try this and see if your problems go away:
public void TypeCustomMessage(string message)
{
SendKeys.SendWait(Regex.Replace(message, #"(\+|\^|%|~|\(|\)|\[|]|\{|})", "{$1}"));
}
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to scan a portion of the webpage for specific URLs using htmlagilitypack and C#. How can I do it? For example I would like to scan only the links of the ads from this page http://www.olx.in/mobile-phones-cat-831 and not all the links.
It looks like each of the Add links is nested inside a div with a specific class (adListDetails), so one can look for any links inside a div with said class. That would look like this:
var nodes = document.DocumentNode.SelectNodes("//div[class='#adListDetails']//a[#src]");
foreach (var node in nodes)
{
string src = node.Attributes["src"].Value;
}
Learn more XPath from a source like w3schools.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want to write some property item to image. Though I could not do it. But I can edit any currently added property. So I want to know is there are any property item I can use for my purpose? Here are some Id I am getting:
Id:271
type 2
Id:272
type:2
Id:274
type:3
Id:282
type:5
Id:283
type:5
Id:296
type:3
Id:306
type:2
....
etc.
My question is can I use any of the currently present property?
Sounds simple i think
<img id="myimage" data-id="data you want to pass"/>
if you want to add attribute from c# then
ddLedger.Attributes.Add('data-id','yourvalue');
So you want to access this property at backend c# then
string aa=myimage.attributes("data-id");
in string aa you will get your data....
and in jquery
$('#myimage').attr('data-id');
Now if you want to add it at run time then like this
$('#myimage').attr('data-id','your id added');
Demo
Check this url for more details
https://stackoverflow.com/a/1735239/2630817
I hope this will help you....:)