如何限制或限制用户只在文本框中输入最多五个字符?
以下是输入字段作为我的表单的一部分:
<input type="text" id="sessionNo" name="sessionNum" />
Run Code Online (Sandbox Code Playgroud)
它是使用像maxSize之类的东西吗?
我正在写一个页面,我需要一个html表来维持一个设置的大小.我需要表格顶部的标题始终保持在那里,但无论表格中添加了多少行,我还需要滚动表格的主体.
我希望它看起来像这个网址中的方法2:http://www.cssplay.co.uk/menu/tablescroll.html
我试过这样做但没有滚动条出现:
<table border=1 id="qandatbl" align="center">
<tr>
<th class="col1">Question No</th>
<th class="col2">Option Type</th>
<th class="col1">Duration</th>
</tr>
<tbody>
<tr>
<td class='qid'></td>
<td class="options"></td>
<td class="duration"></td>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
CSS:
tbody {
height:80em;
overflow:scroll;
}
Run Code Online (Sandbox Code Playgroud) 我只是想知道什么是父表以及数据库中的子表是什么.你能告诉我一个例子,所以我理解它是如何运作的.
谢谢
我有一个文本框.有没有一种方法,用户可以输入的最高值是100,最低值是0?
因此,如果用户输入的数字超过100,那么它将使用keyup()函数自动将值更改为100,如果用户输入的数字小于0,它将显示为0?
我的文本框如下:
<input type="text" name="textWeight" id="txtWeight" maxlength="5"/>%</td>
Run Code Online (Sandbox Code Playgroud)
可以使用JavaScript完成吗?
我想知道在SOAPUI中设置文件夹目录的正确方法是什么.我应该在每个测试用例或测试套件级别中使用安装脚本,还是应该在需要时在groovy脚本步骤中设置它们?
目前我决定只使用groovy脚本方法,因为如果我在安装脚本中使用它,则意味着我必须先运行安装脚本才能获得文件夹目录,然后才能运行包含脚本断言的测试用例.
下面是我在groovy脚本(称为测试脚本)中设置的文件夹目录的示例:
def date = new Date()
def folderTime = date.format("yyyy-MM-dd HH-mm-ss")
//Create a folder directory for the responses
RootResultFolder = dataFolder + "\\Log Smoke Test Data" + "\\xxx" + "\\xxx - " + folderTime + "\\"
CreateResultFolder = new File(RootResultFolder)
CreateResultFolder.mkdir()
...
context.setProperty( "RootResultFolder", RootResultFolder )
Run Code Online (Sandbox Code Playgroud)
下面是我在使用上述文件夹目录的测试步骤中的脚本断言:
def date = new Date().format("yyyy-MM-dd")
def time = new Date().format("HH.mm.ss")
def dataFolder = context.getProperty("RootResultFolder")
def fileName = xxx+ ".txt"
def rootFolder = dataFolder + fileName
def logFile = new File(rootFolder)
logFile.write …Run Code Online (Sandbox Code Playgroud) 我在执行特定EditText字段中的发送密钥时遇到问题。我尝试了一个肮脏的xpath和id,但是它仍然没有输入文本字段。但是我觉得找到元素没有问题。但是,它不会单击到元素中。
因此,应用程序中发生的事情是,当用户选择页面时,它会打开一个Web视图,并且该EditText字段位于其中WebView。
这是我从鸦片检查员那里得到的肮脏的xpath:
/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup/android.support.v4.view.ViewPager/android.view.ViewGroup/android.widget.EditText[1]
Run Code Online (Sandbox Code Playgroud)
这是不错的ID:
@FindBy(id = "test_number")
public WebElement testNumberTextField;
Run Code Online (Sandbox Code Playgroud)
我也尝试使用肮脏的xpath通过xpath使用find。
这是我尝试输入文本的方法。通过注释的代码,您可以看到我也尝试了其他方法来使其正常运行,但仍然没有成功:
public void enterTestNumber(){
//List<WebElement> menu22 =drive.getDriver().findElements(By.className("android.widget.EditText"));
// menu22.get(1).sendKeys(randomStringGeneratorMethods.randomAlphaNumericString(7));
testPage.testNumberTextField.sendKeys(randomStringGeneratorMethods.randomAlphaNumericString(7));
//js.executeScript("document.getElementById('"+testPage.testNumberTextField+").value='"+randomStringGeneratorMethods.randomAlphaNumericString(7)+"';");
}
Run Code Online (Sandbox Code Playgroud)
随机生成器只是一个随机字符串生成器,它是:
public String randomAlphaNumericString(int characterLength) {
return RandomStringUtils.randomAlphanumeric(characterLength);
}
Run Code Online (Sandbox Code Playgroud)
有谁知道如何使它工作,以便可以在此EditText字段中键入文本?
我的if(isset($_POST['submit']))代码有点问题.我想要的是一些回声和一个表,当脚本打开时不会出现,但我希望它显示何时单击表单的提交按钮.问题是,当我包含该if(isset($_POST['submit']))功能时,当我点击提交按钮时,它根本不显示回声和表格.为什么这样,请你帮我解决这个问题.
以下是代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Exam Interface</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<p><strong>NOTE: </strong>If a search box is left blank, then the form will search for all data under that specific field</p>
<form action="exam_interface.php" method="post" name="sessionform"> <!-- This will post the form to its own page"-->
<p>Session ID: <input type="text" name="sessionid" /></p> <!-- Enter Session Id here-->
<p>Module Number: <input type="text" name="moduleid" /></p> <!-- Enter Module …Run Code Online (Sandbox Code Playgroud) 我希望我的selenium IDE测试用例像下面的步骤一样运行,以便自动选择日期:
有人可以告诉我,因为我是硒新手,如何为上述例子做这件事吗?我的所有脚本目前都可以打开日历.
下面是我设法收到的与上面截图匹配的html:
//Months drop down
<select class="ui-datepicker-month" data-handler="selectMonth" data-event="change">
<option value="2" selected="selected">Mar
</option><option value="3">Apr</option>
<option value="4">May</option>
<option value="5">Jun</option>
<option value="6">Jul</option>
<option value="7">Aug</option>
<option value="8">Sep</option>
<option value="9">Oct</option>
</select>
//Years drop down
<select class="ui-datepicker-year" data-handler="selectYear" data-event="change">
<option value="2016" selected="selected">2016</option>
</select>
<table class="ui-datepicker-calendar">
//days labels
<thead>
<tr>
<th scope="col"><span title="Monday">Mo</span></th>
<th scope="col"><span title="Tuesday">Tu</span></th>
<th scope="col"><span title="Wednesday">We</span></th>
<th scope="col"><span title="Thursday">Th</span></th>
<th scope="col"><span title="Friday">Fr</span></th>
<th scope="col" class="ui-datepicker-week-end"><span title="Saturday">Sa</span></th>
<th scope="col" class="ui-datepicker-week-end"><span title="Sunday">Su</span></th>
</tr>
</thead>
<tbody>
//dates
<tr>
<td class=" ui-datepicker-other-month …Run Code Online (Sandbox Code Playgroud) 我live()在下面的jquery中有一个函数:
$("#qandatbl td.weight input").live("change", calculateTotal);
function calculateTotal()
{
var totalweight = hundred;
$("#qandatbl td.weight input").each(function (i, elm){
totalweight = totalweight - parseInt($(elm).val(), 10);
});
$("#total-weight").text(totalweight).append('%').css('font-weight', 'bold');
}
Run Code Online (Sandbox Code Playgroud)
现在有人说这个live()功能正在逐渐消失,最好使用这个on()功能.如果这是真的,那么如何将上面的代码更改为on()函数而不是live()函数?重要的是我不使用live()或不是真的那么重要吗?
html ×4
javascript ×3
jquery ×2
mysql ×2
php ×2
selenium ×2
android ×1
appium ×1
automation ×1
css ×1
database ×1
datepicker ×1
dom ×1
forms ×1
groovy ×1
html-table ×1
if-statement ×1
input ×1
isset ×1
java ×1
overflow ×1
post ×1
scroll ×1
soapui ×1
textbox ×1
timepicker ×1