使用控制台测试应用程序将pata发布到网站。 [英] Post pata to website using console test application.
问题描述
大家好,
我正在尝试将数据发布到网页控件,但可能会错过一些重要的电话。
确切要求:
1)打开网址
2)登录该应用程序
3)点击指向所需页面的链接或直接使用下一页网址获取HTML网页回复。
到这里一切都很好
4)现在我需要在Web响应中提供2个可用文本框项目中的一些数据,然后单击按钮将页面数据发布到站点和数据库并获取重定向的URL
我被困在第四点。
任何人都可以帮助
提前致谢
请注意它是一个用于创建此测试套件的C#控制台应用程序。
Hi All,
I am trying to post data to a web page control but may be missing some important call.
Exact requirement:
1) Open an url
2) sign in to the application
3) Click a link to desired page or directly use the next page url to get the HTML webresponse.
Till here everything is fine
4) Now i need to put some data in 2 available textbox items available in the web response and click a button to let the page data posted to site and database and get the redirected URL
I am stuck in the 4th point.
Can anyone help
Thanks in advance
note its a C# console application i m using to create this test suit.
推荐答案
我遇到了与screenscraper程序类似的问题,并使用以下代码:
I had a similar issue with a screenscraper program, and solved it with the following code:
HtmlElement element = Document.All["username"];
element.SetAttribute("value", myLogon);
element = Document.All["password"];
element.SetAttribute("value", myPassword);
element = Document.All["commit"];
element.InvokeMember("click");
文本框在网页的DOM中命名为用户名
和密码
,以及操作按钮标记为 commit
。您只需要查看HTML源代码,找到您希望更改或以其他方式操作的元素的名称。
The textboxes are named username
and password
in the DOM of the web page, and the action button is labelled commit
. You just need to look into the HTML source to find the names of the elements that you wish to alter or otherwise manipulate.
这篇关于使用控制台测试应用程序将pata发布到网站。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!