---
title: "selenium 测试ajax的关键"
author: "IvanLi"
date: "2009-01-20T18:26:46Z"
tags: []
slug: "selenium-ajax"
draft: false
lastmod: "2009-01-20T18:26:46Z"
id: 319391
url: "https://ivanl.iteye.com/blog/319391"
---

1: waitForCondition(contidtion, timeout)

2:selenium.browserbot.getCurrentWindow().document

下面是sample 用法

 

req\_rsvn\_01 open /itr/secure/index.jsp clickAndWait link=Request & Manage Reservations (Week at a Glance) waitForCondition selenium.browserbot.getCurrentWindow().document.forms\[0].originIndex.options.length&gt;1 10000 select originIndex label=!!Test Location Y - Test Y Town, NE waitForCondition selenium.browserbot.getCurrentWindow().document.forms\[0].destIndex.options.length&gt;1||selenium.browserbot.getCurrentWindow().document.forms\[0].destIndex.options\[0].text!=’Select One’ 10000 select destIndex label=!!Test location Z - Test Z town , NE waitForCondition selenium.browserbot.getCurrentWindow().document.forms\[0].eqmtIndex.options.length&gt;1||selenium.browserbot.getCurrentWindow().document.forms\[0].eqmtIndex.options\[0].text!=’Select One’ 10000 select eqmtIndex label=Container clickAndWait submitBtn waitForCondition selenium.browserbot.getCurrentWindow().document.getElementById(’testCheck0′)!=null 10000 click id=testCheck0 waitForCondition selenium.browserbot.getCurrentWindow().document.getElementById(’id\[0].newStandbyCount’)!=null 10000 type id\[0].newStandbyCount 1 keyUp id\[0].newStandbyCount clickAndWait requestButton