小编Joh*_*ohn的帖子

Selenium IDE:在新选项卡中打开并将焦点切换到新选项卡不起作用

我在selenium ide中陷入了一个问题

场景是这样的

Login-----

go to dashboard page---------

mouse over any menu on the top navigational bar----

on mouseover sub menu will appear as drop down--

now click any link from the drop down --

after clicking link will open in new tab
Run Code Online (Sandbox Code Playgroud)

现在,从那时起,我们必须将重点转移到新选项卡上,因为其余的测试将在新选项卡上完成.

我写的代码如下

     <tr>
    <td>open</td>
    <td>/magma/dev/</td>
    <td></td>
</tr>
<tr>
    <td>type</td>
    <td>name=user_id</td>
    <td>abcd</td>
</tr>
<tr>
    <td>type</td>
    <td>name=pass</td>
    <td>1234</td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>id=btnLogin</td>
    <td></td>
</tr>
<tr>
    <td>verifyTextPresent</td>
    <td>Costing List</td>
    <td></td>
</tr>
<tr>
    <td>verifyTextPresent</td>
    <td>Fuel</td>
    <td></td>
</tr>
<tr>
    <td>mouseOver</td>
    <td>//div[@id='smoothmenu1']/ul/li[3]</td>
    <td></td> …
Run Code Online (Sandbox Code Playgroud)

selenium selenium-ide

8
推荐指数
1
解决办法
3万
查看次数

如何在Selenium IDE中自动化鼠标滚动事件

我试图在selenium IDE中捕获/自动化鼠标滚动事件.就像在Facebook好友列表页面中一样,我们必须滚动到最后才能列出所有朋友.

我想使用Selenium IDE自动化该功能.

我做了什么 :

  1. 用我目前的脚本我可以登录Facebook.

  2. 然后点击标题中的我的名字,我可以转到我的个人资料页面.

  3. 在我的个人资料页面,我正在存储朋友数量的值,然后点击朋友链接我可以转到朋友列表页面.

  4. 在使用断言功能的朋友列表页面中,我将我在前一页面上存储的号码朋友的值与在朋友列表页面上显示的号码进行比较.

我无法做到的

  1. 我想使用命令滚动并比较已经列出的好友以及剩余多少,

如果(剩余<1)那么我将不会进一步滚动

否则我会滚动一段时间并再次比较剩下多少.

selenium selenium-ide mouseevent

6
推荐指数
1
解决办法
2万
查看次数

使用Selenium Webdriver连接远程数据库,并通过eclipse从本地计算机运行测试用例

我正在使用selenium web驱动java构建,编辑器是eclipse.为了测试我们的一个网站,我通过从MySQL数据库中获取数据来使用数据驱动的测试.

我将开发服务器数据库转储到我的本地计算机,并将转储的数据安装到我的机器xampp中,并能够连接到数据库并继续完成测试过程.

要连接到我的本地计算机数据库,我使用此连接字符串

String url1 ="jdbc:mysql://localhost:3306/databasename";           
String dbClass = "com.mysql.jdbc.Driver";
Class.forName(dbClass).newInstance();
Connection con = DriverManager.getConnection(url1, "root", "");
Statement stmt = (Statement) con.createStatement();
Run Code Online (Sandbox Code Playgroud)

现在我需要连接到远程服务器中的原始开发服务器数据库.

我试过这个连接字符串来连接远程机器

 String url1 ="jdbc:mysql://10.0.2.129:3306/test";
 String dbClass ="com.mysql.jdbc.Driver";
 Class.forName(dbClass).newInstance();
 Connection con = DriverManager.getConnection(url1, "root","root");
Run Code Online (Sandbox Code Playgroud)

但无法连接到远程机器数据库.显示以下错误

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
        at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
Run Code Online (Sandbox Code Playgroud)

任何人都可以建议我在连接字符串中需要做哪些更改才能连接远程服务器数据库,该数据库是否受到访问保护?以及如何在连接到远程服务器数据库时从本地计算机运行我的测试用例.

请提供一些建议.

java .htaccess selenium selenium-webdriver

6
推荐指数
1
解决办法
1万
查看次数

Selenium Web Driver:php-webdriver-bindings的findElementsBy()函数返回错误

我正在编写代码自动生成的下拉,如谷歌搜索帮助,并尝试打印自动生成的下拉值作为输出.

在selenium WebDriver中捕获多个与xpath定位符匹配的元素,我们必须使用findElementsBy()函数,

我写的代码如下

<?php 
require_once 'www/library/phpwebdriver/WebDriver.php';
class PHPWebDriverTest extends PHPUnit_Framework_TestCase {
 protected $webdriver;

    protected function setUp() {
        $this->webdriver = new WebDriver("localhost", 4444);
        $this->webdriver->connect("firefox");
    }

    protected function tearDown() {
    //    $this->webdriver->close();
    }
    public function testgooglesearch() {                          
    $this->webdriver->get("http://google.com");
    $element=$this->webdriver->findElementBy(LocatorStrategy::name, "q");           
    $element->sendKeys(array("selenium" ) );
    $result=$this->webdriver->findElementsBy(LocatorStrategy::xpath,"//*[@id=\'gsr\']/table/tbody/tr/td[2]/table/tbody/tr[*]/td/");
    echo $countresult=count($result);

    }
}
?>
Run Code Online (Sandbox Code Playgroud)

根据绑定,findElementsBy()函数将假设返回一个数组.所以当我试图计算数组长度时,错误正在返回.

错误:尝试获取非对象的属性.

任何人都可以帮助我如何进行.

php selenium phpunit selenium-webdriver

0
推荐指数
1
解决办法
2809
查看次数