我正在使用Ubuntu 11.04和selenium 2.9.0以下是我在root pom中的配置方式:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.9.0</version>
<scope>test</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)
在准备运行测试时,我得到一个例外:
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
*** LOG addons.xpi: startup
*** LOG addons.xpi: Ignoring file entry whose name is not a valid add-on ID: > /tmp/anonymous3804893394247066972webdriver-profile/extensions/webdriver-staging
*** LOG addons.xpi: checkForChanges
*** LOG addons.xpi: No changes found
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:95)
....
Run Code Online (Sandbox Code Playgroud)
据我搜索它,问题是selenium使用的firefox驱动程序与浏览器的版本不兼容.考虑到firefox发布的频繁更新,维护我的本地测试环境将很困难.
因此,我决定安装一个静态firefox与我最新的兼容版本并使用selenium,同时保留我的默认firefox(我不能删除它).
所以,我不知道如何设置我的selenium配置,以使其与静态Firefox一起使用.可能我必须配置我的应用程序以接收驱动程序使用的firefox二进制文件的路径?我想知道是否还需要其他东西.
**编辑
我正在使用配置属性来初始化正确的webdriver:
public abstract class SeleniumTestBase {
...
public final void setUp() throws Exception {
String driverClass …Run Code Online (Sandbox Code Playgroud) 给定基类 Coin
public class Coin { }
Run Code Online (Sandbox Code Playgroud)
和两个派生类Coin50Cent和Coin25Cent
public class Coin50 : Coin { }
public class Coin25 : Coin { }
Run Code Online (Sandbox Code Playgroud)
任务是创建一个对象CoinMachine(用于硬币交换,例如投入50美分硬币返回两个25美分硬币),对应以下要求:
CoinMachine必须有两个Coin25Cent和Coin50cent对象的集合.
集合必须从CoinStack<T>具有两种方法的抽象泛型类派生
void Push(T item);
T Pop();
CoinMachine 必须如下工作
Run Code Online (Sandbox Code Playgroud)
CoinMachine.Push(new Coin25()); // puts 25cent in 25c stack
CoinMachine.Push(new Coin50()); // puts 50cent in 50c stack
CoinMachine.Pop(); // gets 50cent from 50c stack
CoinMachine.Pop(); // gets 25cent from 25c stack
这是我的实现似乎我在抽象CoinStack类中有一个问题.
namespace ConsoleApplication1
{
/* Given …Run Code Online (Sandbox Code Playgroud) 最近我一直非常喜欢C#,我只是用它测试,但似乎有一部分我没有得到.
基本上我想要它,这样当我点击SAVE按钮时必须将列表框中的所有项目保存到文本文件中.目前在文件中提出的所有内容都是System.Windows.Forms.ListBox+ObjectCollection.
这是我到目前为止所得到的.随着SaveFile.WriteLine(listBox1.Items);我尝试使用许多不同的方法的部分,我似乎无法搞清楚.还要记住,在我的程序的最终产品中,我希望它回读那个文本文件并将文本文件中的内容输出到列表框中,如果这不可能那么我的不好,我是新手C#毕竟;)
private void btn_Save_Click(object sender, EventArgs e)
{
const string sPath = "save.txt";
System.IO.StreamWriter SaveFile = new System.IO.StreamWriter(sPath);
SaveFile.WriteLine(listBox1.Items);
SaveFile.ToString();
SaveFile.Close();
MessageBox.Show("Programs saved!");
}
Run Code Online (Sandbox Code Playgroud) 目前我正在学习ASP.NET中的新主题Web服务,但我不了解Web服务中SOAP和RESTful的概念以及如何在.NET中创建这些类型的服务.
我在构建maven项目时遇到了问题.我需要生成确定性 jar文件,如果这些版本之间没有源代码更改,则必须在不同版本和版本之间保持二进制一致.为此,我使用本文作为指导.
我已经成功地建立了我的罐子,它们符合我的要求.这是我的配置:
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>step-1-remove-timestamp</id>
<phase>prepare-package</phase>
<configuration>
<target>
<touch datetime="01/01/2015 00:10:00 am">
<fileset dir="target/classes"/>
<fileset dir="src"/>
</touch>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<id>step-3-rename-assembly</id>
<phase>package</phase>
<configuration>
<target>
<copy file="${project.build.directory}/${project.build.finalName}-deterministic.zip"
tofile="${project.build.directory}/${project.build.finalName}.jar"/>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
<configuration>
<descriptors>
<descriptor>src/main/assembly/zip.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>step-2-make-assembly</id>
<phase>prepare-package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,我将jar构建并打包为zip,然后将zip复制到预期的jar工件上.
上面的问题是,maven仍然执行maven-jar-plugin,所以手动组装的jar被其中一个覆盖maven-jar-plugin.我不想使用这个jar,因为它不符合我的要求.
所以,我已经禁用了maven-jar-plugin执行,通过明确地将其设置为运行无效阶段,如下所示:(从此处的其他帖子中看到)
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.5</version>
<executions> …Run Code Online (Sandbox Code Playgroud) 我目前想知道是否可以通过使用 JPA 存储库内的默认接口方法来优雅地解决特定用例。
假设我们有以下实体和支持类型:
public enum Status {
STATUS_1,
STATUS_2,
STATUS_3
}
@Entity
@Getter // from lombok
@Setter // from lombok
public class SomeEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@Column(name = "status")
private Status status;
}
Run Code Online (Sandbox Code Playgroud)
我需要能够查询SomeEntity基于Status枚举值组合的列表。
使用 Spring JPA,其各自的存储库可能如下所示:
@Repository
public interface SomeRepository extends JpaRepository<SomeEntity, Integer> {
@Query("select s.id, ... from SomeEntity s where s.status in (:statuses)")
List<SomeEntity> getByStatuses(@Param("statuses") List<Status> statuses);
}
Run Code Online (Sandbox Code Playgroud)
然而,必须传递的特定状态组合在很大程度上取决于 的域SomeEntity,并且我想在存储库调用中“烘焙”这些状态。为什么在存储库中——当前多个服务使用同一个存储库,并且SomeEntity作为处理根据服务的具体情况一起更新的其他实体的事务的一部分进行更新。所有服务的特定getByStatuses调用都是相同的,并且我们有重复的代码片段,大致如下所示:
List<Status> statuses …Run Code Online (Sandbox Code Playgroud) 是否可以使用任何wix命令来创建数据库并将用户添加到数据库中?如果是的话,有没有关于如何做到这一点的例子?
我有这个javascript代码:
<script>
$(document).ready(function() {
var progValue1 = 100;
var progValue2 = 30;
$("#progressbar").progressbar({ value: progValue1});
$("#progressbar2").progressbar({ value: progValue2 });
});
</script>
Run Code Online (Sandbox Code Playgroud)
我想在单击按钮时从后面的代码中更改两个变量(progValue1和progValue2)的值.....
这是按钮的代码
<asp:Button ID="btnConfirm" CssClass="button" SkinID="Common" runat="server" Text= "Confirm" OnClick="btnConfirm_Click" />
Run Code Online (Sandbox Code Playgroud)
如何从方法的C#代码中更改这些值btnConfirm?
我有这个HTML:
<header class="bar-title"> <a class="button-prev" onclick="history.back(-1)">back</a>
<h1 class="title">Page</h1>
</header>
<div style="overflow:auto;-webkit-overflow-scrolling:touch; height: 100%; width: 100%; padding-top: 42px;">
<iframe style="height: 100%; width: 100%;" src="url"></iframe>
</div>
Run Code Online (Sandbox Code Playgroud)
将iframe被向下滚动/顶部和左/右,但是当我滚动在某个时候跳转到页面顶部.
在 Chrome 和驱动程序更新到第 91 版后,我发现驱动程序为 91.0.4472.19 (win32) 的 VBA 宏变成了从输入标签“值”属性返回空字符串 (""):
Dim ch As SeleniumWrapper.WebDriver
Dim el As WebElement
' some code here ...
ch.findElementById("htmlLoginId").SendKeys login
Set el = ch.findElementById("htmlLoginId")
txt = el.getAttribute("value")
Run Code Online (Sandbox Code Playgroud)
使用较旧的驱动程序版本 90.0.4430.24,这可以正常工作。希望它会在下一个驱动程序版本中得到修复。
还有另一种方法可以从input[type=text]标签中获取价值吗?如果这个错误不会在第 92 个版本中修复并且第 90 个驱动程序版本变得不兼容,我想避免这种情况。