Robot framework - SeleniumLibrary : locator not found error - selenium

I want to locate a dropdown list in robot framework using selenium library. But, I'm facing a locator error like this.
Below is my script and error.
Script
*** Settings ***
Library SeleniumLibrary
*** Variables ***
*** Test Cases ***
Positive Test Case
open browser https://demotestapp-dev.azurewebsites.net/ chrome
input text xpath://body[1]/div[1]/main[1]/article[1]/div[1]/div[1]/div[1]/form[1]/div[1]/div[2]/input[1] Matt
input text xpath://body[1]/div[1]/main[1]/article[1]/div[1]/div[1]/div[1]/form[1]/div[2]/div[2]/input[1] Thomas
click element xpath=//body[1]/div[1]/main[1]/article[1]/div[1]/div[1]/div[1]/form[1]/div[3]/div[2]/div[1]/label[1]
sleep 2
select from list by label Gender Male
select checkbox CheckBox1
click element xpath://body[1]/div[1]/main[1]/article[1]/div[1]/div[1]/div[1]/form[1]/button[1]
close browser
click link xpath://body/div[1]/div[1]/div[2]/nav[1]/div[1]/a[2]
*** Keywords ***
Error
Positive Test Case
| FAIL |
List with locator 'Gender' not found.
-------------------------------------------------------------------
-----------
TC 01
| FAIL |
1 test, 0 passed, 1 failed
Here, the "Gender" is the Radzen component name.
Code
<div class="row mb-5">
<div class="col-md-4">
<RadzenLabel Text="Gender" />
</div>
<div class="col d-flex flex-row">
<RadzenDropDown #bind-Value="student.Gender" Data="#genders" style="width: 100%;" TextProperty="Name" ValueProperty="Id" Name="Gender" >
</RadzenDropDown>
<RadzenRequiredValidator Component="Gender" Text="Gender is required" Popup=true Style="position: absolute" />
</div>
</div>
I tried using div classes.But I got the same not found error.Can anyone give a solution for this?

Related

Trying to add horizontal slider ranger bar in Java EE

I am trying to add prime face slider horizontal bar from this link in my xhtml file of JAVA EE: https://www.primefaces.org/showcase/ui/input/slider.xhtml?jfwid=fa7b8
the code is :
<h5 class="p-mt-0">Basic</h5>
<h:panelGrid columns="1" style="margin-bottom: 10px">
<p:inputText id="txt" value="#{sliderView.number1}"/>
<p:slider for="txt" range="false"/>
</h:panelGrid>
but i am getting error like: Error Parsing /beergame_user.xhtml: Error Traced[line: 116] The prefix "p" for element "p:inputText" is not bound and same for p:slider.
my head tags are same as indicated in documentation of prime face which are:
but still the error is showing.

Invalid generated code while compiling template 'web.ViewSwitcherButton' odoo

Traceback:
Error: Invalid generated code while compiling template 'web.ViewSwitcherButton': missing ) after argument list
at QWeb._compile (http://****/web/content/112-34b6e20/web.assets_common.js:971:133)
at Object.atNodeEncounter (http://****/web/content/112-34b6e20/web.assets_common.js:1056:140)
at QWeb._compileNode (http://****/web/content/112-34b6e20/web.assets_common.js:990:54)
at QWeb._compileChildren (http://****/web/content/112-34b6e20/web.assets_common.js:1027:108)
at QWeb._compileNode (http://****/web/content/112-34b6e20/web.assets_common.js:997:6)
at Object.atNodeEncounter (http://****/web/content/112-34b6e20/web.assets_common.js:1066:44)
at QWeb._compileNode (http://****/web/content/112-34b6e20/web.assets_common.js:990:54)
at QWeb._compileChildren (http://****/web/content/112-34b6e20/web.assets_common.js:1027:108)
at QWeb._compileNode (http://****/web/content/112-34b6e20/web.assets_common.js:997:6)
at QWeb._compileChildren (http://****/web/content/112-34b6e20/web.assets_common.js:1027:108)
This message appears on all pages and we cannot do anything.
When I activate developer mode with assets, it works fine.
I also face same problem when i using Odoo version 14.0-20210305. The problem is from file odoo/addons/web/static/src/xml/base.xml.
I try take base.xml from stable version in my case i take from version 14.0-20210108. Then i replace to new version.
Here part code of stable version:
<t t-name="web.ViewSwitcherButton" owl="1">
<button type="button"
t-att-accesskey="view.accessKey"
t-attf-class="btn btn-secondary fa fa-lg o_switch_view o_{{ view.type }} {{ view.icon }}"
t-att-class="{ active: env.view.type === view.type }"
t-attf-aria-label="View {{ view.type }}"
t-attf-title="View {{ view.type }}"
data-toggle="tooltip"
tabindex="-1"
t-on-click="trigger('switch-view', { view_type: view.type })"
/>
</t>
When you activate developer mode with assets it works fine, then try to upgrade web module!
Thanks fo the solution this helps and work for me too.
This is located as a bug you can check the error here.
https://github.com/odoo/odoo/issues/68040
Regards!

Vue.js link redirection to external site

I am new to Vue.js and I am trying to solve the following issue.
I have a component which look as follows:
<template>
<div class="capture-photo">
<input id="chooseFile"
type="file"
accept="image/*"
capture="environment"
#change="onImageCaptured($event.target.name,
$event.target.files)">
<div v-show="imgURL">
<img v-bind:src="imgURL" style="width:200px">
<button id="sendImage" v-on:click.prevent="post">Send Image</button>
<div id="extractedLink">
<a id="extractedLinkButton" v-bind:href="urlLink">{{ urlLink }}</a>
</div>
</div>
and I am trying to run a test that would check that the link is clicked and redirects to the correct page (the urlLink is defines in the data element of my component. The testing in done using nightwatch and the test code looks like this:
'Redirect the extracted url to the actual website': function test(browser) {
const devServer = browser.globals.devServerURL;
browser
.url(devServer)
.waitForElementVisible('#app', 5000)
.click('input[id="chooseFile"]')
.setValue('input[type="file"]', require('path').resolve('http://www.coolture.pt/wp-content/uploads/2017/10/nos-alive-18-3.jpg'))
.click("#sendImage")
.assert.elementPresent('#extractedLink', 'http://nosalive.com')
.assert.elementPresent("#extractedLinkButton")
.click("#extractedLinkButton")
.assert.urlEquals('http://nosalive.com')
.end();
},`
when running the test, the error message that I receive is the following:
TEST FAILURE: 1 assertions failed, 35 passed. (38.623s)
✖ capturePhoto
- Redirect the extracted url to the actual website (2.8s)
Testing if the URL equals "http://nosalive.com". - expected "http://nosalive.com" but got: "http://localhost:8081/#/"`
where http://nosalive.com, being the urlLink value.
Any help would be greatly appreciated.
Thank you
N

"Unable to resolve constructor for: '"dojox.mobile.TextBox"'"

I am facing following issue while working with dojo inline template:
I am creating the template in a html page by defining the template in between the following tags(It has mvc also integrated)
`<script id="createNewItem" type="text/template">
<div>
<div data-dojo-type='dijit/TitlePane' data-dojo-props='open:false'>
<div class='accordionRev'>
<input type="number" name="qty" placeholder="Quantity (required)" data-dojo-type="dojox.mobile.TextBox" class='quantity' data-dojo-props="value: at('rel:','quantity'), class:at('rel:', 'quantityErr')" onchange="cntrl.createQuoteFields(true, this, '{{lineNumber}}');" onkeypress="cntrl.quantityHandler.call(this, '{{lineNumber}}')" onpaste="cntrl.pastehandler.call(this)" tabindex=0/>
</div>
</div>
</div>
</script>'
I will be using this template in another page like this
`<ul id="rfqTitlePane" class="hide"
data-dojo-type="dojox/mvc/WidgetList"
data-dojo-mixins="dojox/mvc/_InlineTemplateMixin"
data-dojo-props="children: at(cntrl.createQuoteList,'items').direction(at.from)"
data-mvc-child-type="dojox/mvc/Templated"
data-mvc-child-props="clickable: true, variableHeight: 'true',
indexAtStartup: this.indexAtStartup,
customTitle: at(this.target, 'title').direction(at.both), titlePaneDOM:at(this.target,'displayDetails').direction(at.from).transform({format:custom.helpers.RequestMarkup})">
<script type="dojox/mvc/InlineTemplate">
<li>
${titlePaneDOM}
</li>
</script>
</ul>`
I am getting "Unable to resolve constructor for: '"dojox.mobile.TextBox"'" error. I actually defined textbox before the template gets loaded. I am not sure where its going wrong
It appears that the question contains wrong markdown, so I'd recommend fixing that so that better answers can be provided. Meanwhile some things I can say are:
You may want to try importing dojox/mobile/TextBox module before running the template.
Recent releases of Dojo prefers AMD format in data-dojo-type e.g. data-dojo-typ="dojox/mobile/TextBox".
dojox/mvc/InlineTemplateMixin looks at <script type="dojox/mvc/InlineTemplate"> instead of <script type="text/template">.
Hope this helps.
Best, Akira

Codeception see and dontSee both fail

I'm using the Selenium2 module for acceptance tests
My acceptance.suite.yml contains
class_name: WebGuy
modules:
enabled: [Selenium2]
config:
Selenium2:
url: 'http://localhost/'
browser: firefox
capabilities:
unexpectedAlertBehaviour: 'accept'
In my test file I've tried both of the following and they both fail
$I->seeElement('.menu .subMenu');
$I->dontSeeElement('.menu .subMenu');
I would expect the dontSee assertion to pass as the sub menu is hidden by default
The error I get is
Guy unexpectedly managed to see element ".menu .subMenu": Failed asserting that an object is empty.
The beginning of my HTML looks like this
<div class="menu">
<div class="subMenu" style="display: none;">
<ul>
<li>Contact</li>
</ul>
</div>
</div>
Try using XPaths:
$I->seeElement("//div[#class='menu']");
I believe this is a bug in Codeception: https://github.com/Codeception/Codeception/issues/617
Edit: Switching to the WebDriver module instead of Selenium seems to have fixed the problem for me.
Is disabled your HTML-code div.menu by display:none;? Perhaps that's the reason.
I think, I have had a similiar problem with the webdriver and the code
$checkHygienePlans = $I->grabMultiple('.js-my-test-block a');
The result $checkHygienePlans was an array with empty string and $I->assertContains('TestSomeThing', $checkHygienePlans); would fail the test.
The reason was, that the wraping block of the element with class js-my-test-block was hidden with CSS display: none;
After I used codeception to untoggle that block, everything worked fine.