【发布时间】:2015-03-24 03:00:12
【问题描述】:
<html>
<head></head>
<body>
<div id="title"></div>
<div id="credit"></div>
<div id="btnFS"></div>
<div id="cont">
<div id="fscont">
<div style="font-size: 0px; position: absolute; left: 0; right: 0; top: …w: auto; overflow-y: auto; -webkit-overflow-scrolling:touch;"></div>
<div style="font-size: 0px; position: absolute; left: 0; right: 0; height: 75px; overflow: hidden; bottom: 0;">
<iframe width="100%" height="100%" frameborder="0" name="cboxform" scrolling="no" marginwidth="0" marginheight="0" src="//www4.cbox.ws/box/?boxid=4255329&boxtag=ev9nj4&sec=form" allowtransparency="yes">
#document
<!DOCTYPE html>
<html style="position: absolute; height: 100%; width: 100%; overflow: hidden; margin: 0px; padding: 0px;">
<head></head>
<body class="fmbdy" style="padding: 0px; margin: 0px;">
<form class="cfrm" onsubmit="return do_post();" method="post" action="./?boxid=4255329&boxtag=ev9nj4&sec=submit" target="cboxmain" name="cbox">
<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0" style="width: auto;">
<tbody>
<tr></tr>
<tr>
<td id="tblmid" valign="top" style="vertical-align: top; white-space: nowrap; font-size: 0;" colspan="2">
<input type="hidden" value="" name="key"></input>
<input class="frmtb" type="text" onblur="frmblur(this, 'name');" onfocus="frmfocus(this, 'name');" value="name" size="9" autocomplete="off" spellcheck="false" name="nme" maxlength="25" style="box-sizing: content-box; width: 301px;"></input>
我有一个由 cbox.ws 创建的聊天框页面,我想选择此页面上的元素。
我尝试了很多方法来选择此网络中的 id tblmid,但我不能。
使用了很多方法,例如通过名称获取,查找 xpath 然后通过 xpath 获取,通过 css 查找并获取它们......但它不起作用。
我怎样才能得到那个元素?
我正在使用java。
我尝试一步一步 get by id cont -> get by id fscont -> get by name cboxform 但我不能再去了,卡在这里。
WebElement inputName = driver.findElement(By.id("cont"));
inputName = inputName.findElement(By.id("fscont"));
inputName = inputName.findElement(By.name("cboxform"));
非常感谢。
【问题讨论】:
-
我已经添加了代码,你能帮我看看这个问题吗?
-
如果这是 Java,那么您需要删除 JavaScript。它们不一样。
标签: java javascript html selenium xpath