最近学习selenium遇到的问题,求大神帮忙啊!
最近做关于自动化测试框架的毕业设计,公司的老师让我去自学selenium,IDE录制回放脚本搞定了,但是转移到RC上就显示该页面不存在,这到底是为什么呀?
代码我附在下面了:
package abc;
import com.thoughtworks.selenium.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
import java.util.regex.Pattern;
public class Abc {
private Selenium selenium;
@Before
public void setUp() throws Exception {
selenium = new DefaultSelenium("localhost", 4444, "*custom C:/Program Files (x86)/Internet Explorer/iexplore.exe","http://www.baidu.com");
selenium.start();
}
@Test
public void testAbc() throws Exception {
selenium.open("/index.php?tn=monline_5_dg");
selenium.type("id=kw", "abc");
selenium.click("id=su");
selenium.waitForPageToLoad("30000");
selenium.click("link=ABC News: Breaking News & Latest News - ABC News");
}
@After
public void tearDown() throws Exception {
selenium.stop();
}
}
因为从IDE上转过来也出现了些错误,所以自己也改动了一点。希望selenium的大神能指点一下~
代码我附在下面了:
package abc;
import com.thoughtworks.selenium.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
import java.util.regex.Pattern;
public class Abc {
private Selenium selenium;
@Before
public void setUp() throws Exception {
selenium = new DefaultSelenium("localhost", 4444, "*custom C:/Program Files (x86)/Internet Explorer/iexplore.exe","http://www.baidu.com");
selenium.start();
}
@Test
public void testAbc() throws Exception {
selenium.open("/index.php?tn=monline_5_dg");
selenium.type("id=kw", "abc");
selenium.click("id=su");
selenium.waitForPageToLoad("30000");
selenium.click("link=ABC News: Breaking News & Latest News - ABC News");
}
@After
public void tearDown() throws Exception {
selenium.stop();
}
}
因为从IDE上转过来也出现了些错误,所以自己也改动了一点。希望selenium的大神能指点一下~
...全文
相关推荐
selenium处理元素定位点击无效问题
### Selenium处理元素定位点击无效问题详解在进行Web自动化测试时,经常会出现元素已经定位成功但点击操作却不起作用的情况。
python用pip安装selenium过程中的问题
python环境:anaconda+win10开始学习爬虫,但是在第一天就遇到了大问题,在命令行安装selenium一直提示下列SSL有问题:WARNING: pip is configured wi
Selenium学习笔记
><target name="selenium" depends="compileselenium"> <junit printsummary="yes" haltonfailure="yes"> <!
解决Python selenium get页面很慢时的问题
### 解决Python Selenium Get页面加载缓慢的方法在自动化测试或者网页爬虫开发过程中,经常会遇到使用Selenium进行页面抓取时加载速度过慢的问题。
最新Google web驱动!学习selenium必备神器!
最新版本的ChromeDriver通常与特定版本的Chrome浏览器相兼容,因此在下载时需要注意对应浏览器的版本,以避免兼容性问题。


