Cannot get a valid selector to implement I.click() - nightmare

I am trying to click a button that has these details when I F12
<a data-codecept="searchGo" id="9" class="a-button a-button--white clearfix block showall" suggestrow"="" alt="/s/lundhags/?searchparam=lundhags" onmouseover="suggest.handleMouseOver(9);" onmouseout="suggest.handleMouseOut(9)" onclick="suggest.handleSubmit();" xpath="1">Show all results for 'lundhags'<span class="a-icon a-button__icon a-button__icon--double-arrow"></span></a>
I have copied xpath and I had a code like this=>
I.click('//*[#id="9"]');
and I got this error
Clickable //*[#id="9"] was not found by text|CSS|XPath
What am I doing wrong?

It works now! I used the specific Identifier
I.click('[data-codecept="searchGo"]');

Related

Katalon : Unable to click on object after use switchTo and waitForElementClickable

I have problem with find element in my script. I use switchToframe and waitForElementClickable and a still have error
Unable to click on object 'Object Repository/1_2.Wniosek_o_OsFiz_v2/Page_Do wysyki i robocze - seap-testskgpl/label_Zaznacz lini' (Root cause: com.kms.katalon.core.exception.StepFailedException: Unable to click on object 'Object Repository/1_2.Wniosek_o_OsFiz_v2/Page_Do wysyki i robocze - seap-testskgpl/label_Zaznacz lini'
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:26)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.click(ClickKeyword.groovy:76)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:43)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:72)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:616)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$1.call(Unknown Source)
at 1_2.Wniosek_o_OsFiz_v2.run(1_2.Wniosek_o_OsFiz_v2:85)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1586510087999.run(TempTestCase1586510087999.groovy:23)
This is details for my element:
And this is my code (I still work in iframe, page reload. Element is in this same iframe):
WebUI.waitForElementClickable(findTestObject('Object Repository/1_2.Wniosek_o_OsFiz_v2/Page_Do wysyki i robocze - seap-testskgpl/label_Zaznacz lini'),
10)
WebUI.click(findTestObject('Object Repository/1_2.Wniosek_o_OsFiz_v2/Page_Do wysyki i robocze - seap-testskgpl/label_Zaznacz lini'))
Somebody can help me ?
The XPath for the link you are trying to get is generated by web-recorder. Those selectors tend to be flaky because they are dynamic (so, they won't be the same every time you run the tests). I suggest you learn how to get the XPath yourself using Google DevTools or similar.
In this particular case, change the value of Selected Locator from //div[#id='document0']/div[3]/label to //a[#title='Documenty do wysylki'].

af:inputFile is not calling valueChangeListener method

Summarize the problem
I'm trying to upload an image to a blob in the database and have been following various blogs online to do so.
Provide background including what you've already tried
I've tried enclosing the input file on a form but I get the warning:-
"Only one af:form is supported per page. This warning later escalates to a server exception error and I can't enter said page.
Show some code
<af:panelFormLayout id="pfl1">
<f:facet name="footer"/>
<af:form id="f1" usesUpload="true">
<af:inputFile label="Label 1" id="if1" value="#NewUploadImageBean.file}"
valueChangeListener="#{NewUploadImageBean.upLoadValueChangeListener}"/>
</af:form>
</af:panelFormLayout>
I only have this one form in the entire page.
Describe expected and actual results including any error messages
Would like to the valueChangeListner to call my method. Currently I get the
ADF_FACES-60097 error which then translates to : java.lang.IllegalStateException: ADF_FACES-30124:Multiple forms detected on viewId: /test_pages/employement.jsf. Rich client currently has some limitations in dealing with multiple forms.
How to fix ADF_FACES-30124:Multiple forms detected on viewId ?
To do so remove all the af:forms inside your jsf view expecially the one containing your inputFile and add only one af:form useupload="true" at the highest view tag level :
<af:document >
<af:form usesUpload="true" id="f1">
... ALL YOUR VIEW TAGS ...
</af:form>
</af:document>

Syntax error on data-target in ReactJS

I am completely new to ReactJS and I 'm working on existing app, there I found some error in the line
<span data-toggle="modal" data-target="'#'+{providers.TICKET_NUMBER}">
{providers.TICKET_NUMBER} </span>
The error displaying is "jquery-1.10.2.min.js:21 Uncaught Error: Syntax error, unrecognized expression: '#'+{providers.TICKET_NUMBER}
Kindly please help,if possible. Excuse mistakes,If any.
You need to put the expression in a pair of {}
data-target={"#" + providers.TICKET_NUMBER}>

Syntax error in order() method using ng-click and ng-repeat

I am using the following html code to create an ng-repeat:
<td ng-repeat="parentCategory in totalParentCategoriesCount | orderBy :'-Count'">
<h3>
Kategori
<span class="sortorder" ng-show="predicate === 'CategoryParent{{parentCategory.Count}}'" ng-class="{reverse:reverse}"></span>
</h3>
</td>
I wish to add the text CategoryParent with the number from parentCategory.Count to create a dynamic link.
When inspecting the link in the browser I get the corret outcome which is CategoryParent0, CategoryParent1, CategoryParent2 and so on. But when clicking the link I get the following error:
Error: [$parse:syntax] http://errors.angularjs.org/1.2.16/$parse/syntax?p0=%7B&p1=is%20an%20unexpe…Parent%7B%7BparentCategory.Count%7D%7D&p4=%7B%7BparentCategory.Count%7D%7D
at Error (native)
at http://localhost:51976/Scripts/angular.min.js:6:450
at $a.throwError (http://localhost:51976/Scripts/angular.min.js:165:141)
at $a.parse (http://localhost:51976/Scripts/angular.min.js:164:6)
at $get (http://localhost:51976/Scripts/angular.min.js:96:122)
at http://localhost:51976/Scripts/angular.min.js:129:290
at http://localhost:51976/Scripts/angular.min.js:10:248
at Array.forEach (native)
at q (http://localhost:51976/Scripts/angular.min.js:7:280)
at Uc (http://localhost:51976/Scripts/angular.min.js:10:219)
On the angular page its says the following:
Syntax Error: Token '{' is an unexpected token at column 15 of the expression [CategoryParent{{parentCategory.Count}}] starting at [{{parentCategory.Count}}].
I have been looking at this answer AngularJS expression throwing a Syntax error in ng-click and therefore tried many different compinations in the order() method but I cant figure out how to make the link dynamic without using brackets.
Right now the parentCategory.Count is an int but I have also tried to parse it to a string but without any success.
ng-click already takes an Angular expression - so no need for the {{}}
ng-click="order('CategoryParent' + parentCategory.Count)"

Protractor test failing in firefox (unable to find id) but works in ie/chrome

I have a Protractor test that is running successfully against both IE and chrome, but when i run it against firefox an error is returned claiming that it can not find the element on the page - any ideas?
The HTML looks as follows - once the customer types letters into the box it attempts to provide options:
<form data-ng-submit="submit()" data-ng-show="getCurrentTab()===1" class="navbar-form navbar-left" role="search" data-ng-controller="RouteTabController">
<div class="form-group">
<b>FROM</b>
<div ba-auto-complete field="from" class="autoCompleteDirective" id="fromRoute"/>
</form>
The relevant code in the test is as follows:
var actions = browser.actions();
actions.mouseMove(element(by.id('fromRoute')));
actions.click();
actions.sendKeys("ABC");
On a side note I am using that as when I tried the following it claimed the element did not have focus in both chrome and firefox:
element(by.id('fromRoute')).click();
element(by.id('fromRoute')).sendKeys('ABC');
The answer (I'm ashamed to admit) was that my chrome driver was out of date. When I updated that then firefox worked ok

Resources