我正在尝试用selenium grid 2设置运行selenium测试.我的测试更依赖.我必须很好地定义我的顺序运行和并行运行.附加我的build.xml文件以供ref.在顺序节点内部,我有许多具有不同目标的并行节点.我在运行此build.xml时遇到了不一致的问题.
有时它会选择第二个并行节点的目标,有时则不会.它也没有给出错误.我尝试在详细模式下运行ant命令,仍然没有获得ant异常.
如果有人在这方面提供帮助,将会很高兴.
<target name="startServerRC" depends="startServerhub">
<echo>Starting Selenium Server...</echo>
<java jar="${lib.dir}/selenium-server-standalone.jar" fork="true" spawn="true">
<arg line="-port 5555"/>
<arg line="-log log.txt"/>
<arg line="-firefoxProfileTemplate"/>
<arg value="${lib.dir}/ff_profile"/>
<arg line="-userExtensions"/>
<arg value="${lib.dir}/user-extensions.js"/>
<arg line="-role node"/>
<arg line="-hub http://localhost:4444/grid/register "/>
<arg line="-maxSession 10"/>
<arg line="-maxInstances=10"/>
</java>
</target>
<!-- Initialization -->
<target name="init" depends="startServerRC" >
<echo>Initlizing...</echo>
<delete dir="${classes.dir}" />
<mkdir dir="${classes.dir}"/>
</target>
<!-- Complies the java files -->
<target name="compile" depends="init">
<echo>Compiling...</echo>
<javac
debug="true"
srcdir="${src.dir}"
destdir="${classes.dir}"
classpathref="classpath" />
</target>
<target name="CItarget">
<sequential>
<antcall target="compile"/>
<parallel> …Run Code Online (Sandbox Code Playgroud) 我有这个问题.在不同的计算机上,我启动HUB和NODE,然后在我初始化Google Chrome的地方运行我的测试,如下所示:
Selenium selenium = new DefaultSelenium("localhost", 4444, *googlechrome, "http://www.google.com");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability("chrome.switches", Arrays.asList("--start-maximized"));
WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capabilities);
Run Code Online (Sandbox Code Playgroud)
一切都在我的电脑上正常运行 - Chrome启动并执行脚本.但是,如果我的朋友尝试完全相同,她会收到此错误:
Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.6.0_29'
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:435)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:139)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:94)
at …Run Code Online (Sandbox Code Playgroud) 我的任务是测试一个Web应用程序,该应用程序应该适用于分辨率为1280*1024的屏幕.
然而,我的工作显示器是20英寸屏幕,分辨率为1680*1050.
将Firefox窗口的大小调整为1280*1024是否符合测试标准,还是应该始终更改显示器的分辨率?(显然,第二种选择不是首选).
而且:是否有一个Firefox插件可以帮助我适当地设置窗口大小?
我知道在SO上有这样一个问题,但我找不到它.所以再问一次......
我需要为我的程序设置属性,但我需要让它独立于操作系统 - 在Windows XP和Linux上运行(未知的发行版,未知版本)
更具体地说 - 我需要设置系统在哪里找到chromedriver二进制文件.我需要像这样的伪代码:
if (getOs() == Windows){
System.setProperty(ChromeDriverService.CHROME_DRIVER_EXE_PROPERTY, "chromedriver.exe");
} else{
System.setProperty(ChromeDriverService.CHROME_DRIVER_EXE_PROPERTY, "chromedriver");
}
Run Code Online (Sandbox Code Playgroud)
现在我需要获得操作系统的部分.感谢帮助.
我在用selenium IDE 1.10.0.我正在尝试检查产品类别中图像的存在.我应该使用什么命令来验证图像?
我遇到一个问题,API端点期望%20替换一个空格就需要其中一个参数。例:
$params = array(
'client_id' => self::$client_id,
'scope' => 'api%20offline_access', //here I need the %20 sign
'response_type' => 'code',
'redirect_uri' => self::$redirect_uri
);
Run Code Online (Sandbox Code Playgroud)
如果我写'scope' => 'api offline_access'了空格,则+在将其传递给http_build_query()函数时会转换为符号。
如果我像上面一样保持它,则该标志被“包裹”了更多的标志
我试图在功能手册中找到此答案,但是没有运气
我希望那对括号('{'和'}')将是自动的:
public static void main(String[] args)
{
}
Run Code Online (Sandbox Code Playgroud)
代替:
public static void main(String[] args){
}
Run Code Online (Sandbox Code Playgroud)
有没有办法像Visual Studio一样定义自动完成?
让我们有两个文件:index.php和foo.php foo.php文件将放在子目录/ lib中
现在在index.php中,让我们有这个功能
function bar(){
require('foo.php');
$foo = new Foo();
$foo->bar();
}
Run Code Online (Sandbox Code Playgroud)
并在foo.php
class Foo{
public function __construct(){
echo "baz";
}
public function bar(){
echo "bar";
}
}
Run Code Online (Sandbox Code Playgroud)
现在,错误很难发现:我在要求类Foo时犯了错误,因为require('lib/foo.php')我只写了require('foo.php')
这个错误很难发现,特别是如果你有很多代码行.
现在应该声明类抛出错误?
如果我在线路上$foo = new Foo();出错,那么很容易发现错误.在这种情况下,你得到Fatal error: Call to undefined method Foo::bar()了让你想到的:"但我宣布了这个方法 ",你忘记了错误可能在其他地方.
那么,为什么PHP在创建不存在的新类时不会抛出任何错误?