我的代码中的元素看起来像这样:
<input id="invoice_supplier_id" name="invoice[supplier_id]" type="hidden" value="">
Run Code Online (Sandbox Code Playgroud)
我想设置它的值,所以我用它的xpath创建了一个web元素:
val test = driver.findElements(By.xpath("""//*[@id="invoice_supplier_id"]"""))
Run Code Online (Sandbox Code Playgroud)
但现在我没有看到设置值的选项......
java selenium xpath selenium-chromedriver selenium-webdriver
我有一个函数获取对象列表并将其POST到api.
该函数返回Observable,因为谁调用它期望根据api响应从中获取一个字符串.
如果响应是好的,我想返回一个字符串,如果是错误,我想发送一个不同的字符串.
这是我的函数返回一个字符串:
public sendUpdate(updatedList: Cars[]): Observable<string> {
return this._myService.updateListNewOrder(updatedList)
.map(response => "The POST worked successfully")
.catch(error => Observable.of("An Error occurred"));
}
Run Code Online (Sandbox Code Playgroud)
所以现在我想调用这个函数并在我的component.ts中获取字符串:
messageToDisplay: string;
public updateList() {
this._myService.sendUpdate(this.listToUpdate).subscribe(
res => this.messageToDisplay = res, // onNext
error => this.messageToDisplay = error // onError
);
}
Run Code Online (Sandbox Code Playgroud)
但这不起作用......我没有错误.只是messageToDisplay保持未定义.
有谁看到这个问题?
谢谢!
如果你需要它,这是updateListNewOrder(...):
public updateListNewOrder(newOrderedList: string[]): Observable<ServerResponse> {
let apiURL = "my/api/url";
return this.http.post(apiURL, JSON.stringify(newOrderedList), { headers: this.defaultHeaders() }
);
}
Run Code Online (Sandbox Code Playgroud) 到现在为止我只是喜欢:
val radioButton4: WebElement = driver.findElement(By.id("FieldsubCode2"))
radioButton4.click
Run Code Online (Sandbox Code Playgroud)
但现在我想按值找到元素,这个值:
所以我想去:
val radioButton4: WebElement = driver.findElement(By.value("3.2"))
radioButton4.click
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
selenium selenium-ide selenium-chromedriver selenium-webdriver
我使用了一些来自github的漂亮而简单的拖放库,我有一个带有3个不同按钮的视图,每个按钮在同一个地方点击时都会显示一个列表,但不是在同一时间.
从某种原因,只有第一个列表可以排序,但另外2个没有...我可以移动对象,但它们不可丢弃,所以我不能改变顺序.
这是我的HTML:
<div>
<!-- list 1 button -->
<button md-button
(click)="showFirstList()"
class="md-primary">List 1
</button>
<!-- list 2 button -->
<button md-button
(click)="showSecondList()"
class="md-primary">List 2
</button>
<!-- list 3 button -->
<button md-button
(click)="ThirdList()"
class="md-primary">List 3
</button>
</div>
<md-content>
<div *ngIf="showingListOne">
<div dnd-sortable-container [dropZones]="['zone-one']" [sortableData]="listOneToDisplay | async">
<div class="list-bg" *ngFor="#item of listOneToDisplay | async; #i = index" dnd-sortable [sortableIndex]="i">
ID: {{item.id}} <p></p> name: {{item.name}}
</div>
</div><br><br>
</div>
<div *ngIf="showingListTwo">
<div dnd-sortable-container [dropZones]="['zone-two']" [sortableData]="listTwoToDisplay | async">
<div …Run Code Online (Sandbox Code Playgroud) 我在我的.html文件中有两个列表.我试图让我的代码不重复所以我决定使用ngSwitch,但是当我做下一件事时我得到一个错误:
<div [ngSwitch]="currentListView">
<div *ngSwitchCase="'People'">
<div dnd-sortable-container [dropZones]="['zone-one']" [sortableData]="listOfPeople">
<div class="list-bg" *ngFor="#person of listOfPeople; #i = index" dnd-sortable [sortableIndex]="i">
ID: {{bulk.person}} <p></p> Name: {{person.name}}
</div>
</div>
</div>
<div *ngSwitchCase="'Cars'">
<div dnd-sortable-container [dropZones]="['zone-one']" [sortableData]="listOfCars">
<div class="list-bg" *ngFor="#car of listOfCars; #i = index" dnd-sortable [sortableIndex]="i">
ID: {{car.id}} <p></p> Color: {{car.color}}
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
这是ECH列表的错误:
(承诺中):模板解析错误:无法绑定到'ngSwitchCase',因为它不是已知的本机属性("
Run Code Online (Sandbox Code Playgroud)<div [ngSwitch]="currentListView"> <div [ERROR ->]*ngSwitchCase="'People'"> <div dnd-sortable-container [dropZones]="['zone-one']" [sortableData"): AppCmp@42:9 Property binding ngSwitchCase not used by any directive on an embedded template (" …
我试图将我的项目上传到circleci,但由于某种原因它在一个名为"$ play test"的下拉列表中失败,我不知道它是什么,我根本没有在我的项目中进行测试.
这是我正在讨论的部分:
并且我在那里得到错误,这是错误:
我从我的circle.yml中删除了" - sbt test",所以不是那样,我看到了另一个测试文件夹,所以我想也许就是它,但是它是空的,所以我在其中创建了一个文件并且没有放入其中仍然得到同样的错误...它让我发疯://///
请helpppppp
如果你需要这是我的circle.yml:
machine:
services:
- docker
java:
version: oraclejdk8
environment:
SBT_VERSION: 0.13.9
SBT_OPTS: "-Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M"
dependencies:
cache_directories:
- "~/.sbt"
- "~/.ivy2"
- "~/.m2"
- "~/docker"
pre:
- wget --output-document=$HOME/bin/sbt-launch.jar https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/"$SBT_VERSION"/sbt-launch.jar
- echo "java $SBT_OPTS -jar \`dirname \$0\`/sbt-launch.jar \"\$@\"" > $HOME/bin/sbt
- chmod u+x $HOME/bin/sbt
- sbt sbt-version
override:
- sbt clean update
post:
- find . -type f -regex ".*/target/test-reports/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/ \;
general:
artifacts:
- …Run Code Online (Sandbox Code Playgroud) 我正在使用 scalatest 和 scalacheck,也正在使用 FeatureSpec。
我有一个生成器类,它为我生成对象,如下所示:
object InvoiceGen {
def myObj = for {
country <- Gen.oneOf(Seq("France", "Germany", "United Kingdom", "Austria"))
type <- Gen.oneOf(Seq("Communication", "Restaurants", "Parking"))
amount <- Gen.choose(100, 4999)
number <- Gen.choose(1, 10000)
valid <- Arbitrary.arbitrary[Boolean]
} yield SomeObject(country, type, "1/1/2014", amount,number.toString, 35, "something", documentTypeValid, valid, "")
Run Code Online (Sandbox Code Playgroud)
现在,我有了与 FeatureSpec 一起使用的测试类以及运行测试所需的一切。
在这个类中,我有场景,在每个场景中我想生成一个不同的对象。据我了解,生成对象最好使用 forAll 函数,但 forall 不确定会给您带来一个对象,因此您可以添加 minSuccessful(1) 以确保您获得列表 1 obj... 。
我这样做了并且有效:
scenario("some scenario") {
forAll(MyGen.myObj, minSuccessful(1)) { someObject =>
Given("A connection to the system")
loginActions shouldBe 'Connected
When("something")
//blabla …Run Code Online (Sandbox Code Playgroud) 我在汇编过程中有一个任务来计算字符串中的单词数,我需要将我的答案保存在cx寄存器中.(我正在使用80x86处理器)
所以我设定:
cx为0 - 这将是我的计数器
bx为0 - 这将是我的索引
我想知道我是否正确使用它,这是我的代码:
.model small
.stack 100h
.data
A db ' this is a test $'
B db 100 dup('$')
.code
mov ax, @data
mov ds, ax
mov cx, 0
mov bx, 0
looping:
cmp A[bx], ' '
jne foundchar
inc bx
jmp looping
foundchar:
inc bx
cmp A[bx], ' '
je foundword
cmp A[bx], '$'
je soff
jmp foundchar
foundword:
inc cx
inc bx
jmp looping
soff:
.exit
end
Run Code Online (Sandbox Code Playgroud)
而我班上的其他人也采用了不同的方式,她将si设置为A的偏移...我并不真正理解这个解决方案:
mov cx,0
mov …Run Code Online (Sandbox Code Playgroud) 我正在使用 scalacheck,所以我将能够使用生成器。
所以在我的生成器类中我有类似的东西:
invType <- Gen.oneOf(Seq("Communication", "Restaurants", "Parking"))
invoiceNumber <- Gen.choose(1, 10000)
Run Code Online (Sandbox Code Playgroud)
但现在我想生成:
invoiceDate = "1/1/2014" //todo: generate random date between 2013 - today
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?tnx
我有一些想要执行的请求,到目前为止,我使用带有 json 的 http.post ,如下所示:
this.http.post("https://somepath.com/users/login", JSON.stringify({"email": "someone@gmail.com","password":"123","user_token":"sss"}), RequestOptionsArgs);
Run Code Online (Sandbox Code Playgroud)
但这是行不通的,因为对该网站的请求需要是表单数据主体...我如何才能接受相同的调用并将其更改为表单数据?
谢谢!
angular ×4
typescript ×4
java ×3
scala ×3
scalacheck ×2
scalatest ×2
selenium ×2
assembly ×1
circleci ×1
generator ×1
html5 ×1
http ×1
javascript ×1
json ×1
sbt ×1
selenium-ide ×1
xpath ×1