element.all(by.css('td[data-header-text="products"]')).first()
productCountInTask = taskPage.productCountInTask.getText();
console.log("yyyy",taskPage.productCountInTask.getText());
これはコードです。分度器コンソールが要素またはコンソールと異なって表示されます
分度器コンソールは、私がelementorコンソールでこれを行うとき、それが出力として2を示し、長いテキスト
yyyy { ptor_:
{ setFileDetector: [Function],
launchApp: [Function],
controlFlow: [Function],
schedule: [Function],
getSession: [Function],
getCapabilities: [Function],
quit: [Function],
actions: [Function],
touchActions: [Function],
executeScript: [Function],
executeAsyncScript: [Function],
call: [Function],
wait: [Function],
sleep: [Function],
getWindowHandle: [Function],
getAllWindowHandles: [Function],
getPageSource: [Function],
close: [Function],
getCurrentUrl: [Function],
getTitle: [Function],
findElementInternal_: [Function],
findDomElement_: [Function],
findElementsInternal_: [Function],
takeScreenshot: [Function],
manage: [Function],
switchTo: [Function],
driver:
{ session_: [Object],
executor_: [Object],
flow_: [Object],
fileDetector_: null },
element: { [Function] all: [Function] },
'$': [Function],
'$$': [Function],
baseUrl: 'http://.qa..com:8080',
rootEl: 'body',
ignoreSynchronization: false,
getPageTimeout: 10000,
params: {},
ready:
{ closure_uid_815821442: 20,
flow_: [Object],
stack_: null,
parent_: null,
callbacks_: null,
state_: 'fulfilled',
handled_: true,
value_: null,
queue_: null },
plugins_:
{ pluginConfs: [],
pluginObjs: [],
assertions: {},
resultsReported: false },
resetUrl: 'data:text/html,<html></html>',
trackOutstandingTimeouts_: true,
mockModules_: [ [Object], [Object], [Object] ],
allScriptsTimeout: 240000,
getProcessedConfig: [Function],
forkNewDriverInstance: [Function],
restart: [Function] },
parentElementArrayFinder:
{ ptor_:
{ setFileDetector: [Function],
launchApp: [Function],
controlFlow: [Function],
schedule: [Function],
getSession: [Function],
getCapabilities: [Function],
quit: [Function],
actions: [Function],
touchActions: [Function],
executeScript: [Function],
executeAsyncScript: [Function],
call: [Function],
wait: [Function],
sleep: [Function],
getWindowHandle: [Function],
getAllWindowHandles: [Function],
getPageSource: [Function],
close: [Function],
getCurrentUrl: [Function],
getTitle: [Function],
findElementInternal_: [Function],
findDomElement_: [Function],
findElementsInternal_: [Function],
takeScreenshot: [Function],
manage: [Function],
switchTo: [Function],
driver: [Object],
element: [Object],
'$': [Function],
'$$': [Function],
baseUrl: 'http://.qa..com:8080',
rootEl: 'body',
ignoreSynchronization: false,
getPageTimeout: 10000,
params: {},
ready: [Object],
plugins_: [Object],
resetUrl: 'data:text/html,<html></html>',
trackOutstandingTimeouts_: true,
mockModules_: [Object],
allScriptsTimeout: 240000,
getProcessedConfig: [Function],
forkNewDriverInstance: [Function],
restart: [Function] },
getWebElements: [Function],
actionResults_:
{ closure_uid_815821442: 7800,
flow_: [Object],
stack_: null,
parent_: [Object],
callbacks_: null,
state_: 'pending',
handled_: false,
value_: undefined,
queue_: null },
locator_:
{ using: 'css selector',
value: 'td[data-header-text="products"]' } },
then: [Function],
elementArrayFinder_:
{ ptor_:
{ setFileDetector: [Function],
launchApp: [Function],
controlFlow: [Function],
schedule: [Function],
getSession: [Function],
getCapabilities: [Function],
quit: [Function],
actions: [Function],
touchActions: [Function],
executeScript: [Function],
executeAsyncScript: [Function],
call: [Function],
wait: [Function],
sleep: [Function],
getWindowHandle: [Function],
getAllWindowHandles: [Function],
getPageSource: [Function],
close: [Function],
getCurrentUrl: [Function],
getTitle: [Function],
findElementInternal_: [Function],
findDomElement_: [Function],
findElementsInternal_: [Function],
takeScreenshot: [Function],
manage: [Function],
switchTo: [Function],
driver: [Object],
element: [Object],
'$': [Function],
'$$': [Function],
baseUrl: 'http://.qa..com:8080',
rootEl: 'body',
ignoreSynchronization: false,
getPageTimeout: 10000,
params: {},
ready: [Object],
plugins_: [Object],
resetUrl: 'data:text/html,<html></html>',
trackOutstandingTimeouts_: true,
mockModules_: [Object],
allScriptsTimeout: 240000,
getProcessedConfig: [Function],
forkNewDriverInstance: [Function],
restart: [Function] },
getWebElements: [Function],
actionResults_:
{ closure_uid_815821442: 7800,
flow_: [Object],
stack_: null,
parent_: [Object],
callbacks_: null,
state_: 'pending',
handled_: false,
value_: undefined,
queue_: null },
locator_:
{ using: 'css selector',
value: 'td[data-header-text="products"]' } } }
BTを示しています。 (それはセルで、私はセル値を求めて2です)
element.all(by.css('td[data-header-text="products"]')).first().getText() 2
私は間違っていますか?
私はさまざまな組み合わせを試みましたが、ddは機能しません。私はこの
expect(element.all(
by.css('td[data-header-text="products"]')).first().getText()).toBe(1);
を行うとき、私はそれが出力についてだと思う
ので、それは私はそれが理由ITIS文字列だと思うので、私はint型に変換するのにNumber
を使用しなかったが
Expected '1' to be 1.
を語りますそれは
のために言うExpected NaN to be 1.
仕事
var a = parseInt(element.all(by.css('td[data-header-text="products"]')).first().getText());
//checking if there is only one product
expect(a).toBe(1);
ため
も何をすべきかそう
expect(Number(element.all(by.css('td[data-header-text="products"]')).first().getText())).toBe(1);
は、それが与えることはありません、あなたはgetText()
を記録慰めるかのように、すべての分度器の
Expected NaN to be 1.
:テキストを取得するためにinorderを、次のような
then function()
を使用する必要があります.first()。getText())。toBe( '1'); ' –