Re: Intrepreting Javascript within C#
- From: "Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 18 Sep 2007 11:52:42 -0400
Logician,
Right, and using MSHTML, you would load the page, and then your bot
would manipulate the DOM to set the appropriate input. Once you do that,
the HTML engine will interpret the javascript and then you can access the
DOM to get whatever elements were changed to have the new URL.
--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx
"Logician" <sales@xxxxxxxxxxxxx> wrote in message
news:1190130227.489343.197790@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Sep 18, 4:00 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Logician,I'm not sure how that works. It is an HTML page but generated from
If this is in the context of an HTML page, then why not use an HTML
document host like MSHTML to execute the javascript? You can then access
the document object model (DOM) after the javascript is executed, as well
as
set values on the page and see how the page reacts.
user input, eg a menu click. The bot has to read the js code and then
intrepret it to get the new url, then effectively visit the url. But
as the url is built at run time this is fairly hard.
I checked out some sites and saw, eg grohe.co.uk, that not even google
has indexed much of those sites.
--
- Nicholas Paldino [.NET/C# MVP]
- m...@xxxxxxxxxxxxxxxxxxxxxxxxxxx
"Logician" <sa...@xxxxxxxxxxxxx> wrote in message
news:1190127053.123405.223420@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Does anyone have any idea how this is done?
I am writing a c# bot to grab data from sites, but some sites have
extensive Javascript navigation. This means I have to read the script
and effectively run it within c#.
I have one example from a book (Http programming for bots using c#).
The problem I have is understanding how to setup the package and then
how to process the Javascript code on the site without actually in
effect copying the code.
JScript.Eval E = new JScript.Eval();
String expression = TextBox.Text;
try
{
TextBox1.Text = E.DoEval(expression);
}
JScript is defined as:
package JScript
{
class Eval
{
public function DoEval(expr:String):String
{
return eval(expr);
}
}
}- Hide quoted text -
- Show quoted text -
.
- Follow-Ups:
- Re: Intrepreting Javascript within C#
- From: Logician
- Re: Intrepreting Javascript within C#
- References:
- Intrepreting Javascript within C#
- From: Logician
- Re: Intrepreting Javascript within C#
- From: Nicholas Paldino [.NET/C# MVP]
- Re: Intrepreting Javascript within C#
- From: Logician
- Intrepreting Javascript within C#
- Prev by Date: Can't attach to aspnet_wp.exe worker process (it's not there)
- Next by Date: Re: String.Replace Anomoly
- Previous by thread: Re: Intrepreting Javascript within C#
- Next by thread: Re: Intrepreting Javascript within C#
- Index(es):
Relevant Pages
|