Selenium学习(七) selenium IDE命令之 store系列详解

目录

store系列简介

相关方法

官方API

验证过程

命令详解


store系列简介

主要用于存储,将数据存储到变量中,以便调用;

 

相关方法

store
store attribute
store json
store text
store title
store value
store window handle
store xpath count

 

官方API

store

Save a target string as a variable for easy re-use.

arguments


store attribute

Gets the value of an element attribute. The value of the attribute may differ across browsers (this is the case for the "style" attribute, for example).

arguments

  • attribute locator: An element locator followed by an @ sign and then the name of the attribute, e.g. "foo@bar".

  • variable name: The name of a variable without brackets.


store json

undefined

arguments

  • json: A string representation of a JavaScript object.

  • variable name: The name of a variable without brackets.


store text

Gets the text of an element and stores it for later use. This works for any element that contains text.

arguments


store title

Gets the title of the current page.

arguments


store value

Gets the value of element and stores it for later use. This works for any input type element.

arguments


store window handle

Gets the handle of the current page.

arguments

  • window handle: A handle representing a specific page (tab, or window).

store xpath count

Gets the number of nodes that match the specified xpath (e.g. "//table" would give the number of tables).

arguments

  • xpath: The xpath expression to evaluate.

  • variable name: The name of a variable without brackets.

 

验证过程

测试页面代码store.html

<!DOCTYPE html>
<html>
	<head>
	<title>selenium 学习之 store系列 </title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
</style>
<script type="text/javascript">


</script>
</head>

 <h1>selenium test 之 store系列 </h1>
<div id="main">
  <input type="text" value="" id="test1" name="myinput" /><br/>
  <span id="test2" style="color:red;width:200px">AKDJDJDJDJKL0</span>


	<br/><br/>
	<h3>store value</h3>
	<span id="vv_1">this is span</span><br/>
	<input type="text" id="vv_2" /><br/>
	<input type="text" id="vv_3" value="1" /><br/>
	<br/><br/>

	下拉框
	<select id='vv_4'>
		<option value="volvo">Volvo</option>
		<option value="saab">Saab</option>
		<option value="mercedes">Mercedes</option>
		<option value="audi">Audi</option>
	</select>
	<br/><br/>

	交通工具复选:
	<input type="checkbox" id="vv_5" name="vehicle" value="Car"/>小车<br/>
	<input type="checkbox" id="vv_5x" name="vehicle" value="posche"  checked/>保时捷<br/>
	<input type="checkbox" id="vv_5xx" />三轮车<br/>

	单选颜色:
	<input type="radio" id=
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值