按名称或值获取元素? [英] Get Element by Name or Value?

查看:75
本文介绍了按名称或值获取元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望创建一个登录表单,输入您在电子邮件和密码中输入的文本,然后按登录按钮上的Enter键。我登录按钮的问题没有我使用GetElementById的ID。这是检查元素屏幕的屏幕截图。



http://gyazo.com/3c30fcafe5a55ff42f2f9b809f65a3cf [ ^ ]

解决方案

添加ID!或者您是否期望它会自行添加? :-)







感谢您的澄清。



请看下面我的评论。



你不需要填写表格,它不会给你任何东西。并且 id 根本不会帮助你。您需要以表单的方式发送HTTP请求。为此,您需要使用 System.Net.HttpWebRequest

http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx [ ^ ]。



基本上,HTTP请求数据块的记录由表单输入元素的属性 name 标识,而不是id。您需要使用某些TCP / IP间谍软件来利用一些基本的HTTP或窥探客户端所做的事情。



-SA

I am looking to make a log in form that enters the text that you type in the email and password and then press enter on the log in button. The problem I had the log in button doesn''t have an ID for me to use GetElementById. Here is a screenshot of inspect element screen.

http://gyazo.com/3c30fcafe5a55ff42f2f9b809f65a3cf[^]

解决方案

The add the ID! Or do you expect it will be added by itself? :-)

[EDIT]

Thank you for clarification.

Please see my comments below.

You do not have to fill in the form, it won''t give you anything. And id won''t help you at all. You need to send HTTP request the way the form does. To do that, you need to use System.Net.HttpWebRequest:
http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx[^].

Basically, the records of the HTTP request data block are identified by the attributes name of the form input elements, not id. You need to either lean some basics of HTTP or spy on what client does using some TCP/IP spy software.

—SA


这篇关于按名称或值获取元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆