Is it possible to use the dropdown element in Inquist with no default response? - inquisit

I have a demographic item in Inquisit where participants indicate their response using a dropdown menu.
However, at the moment it default to showing the first response. Thus, if a participant skipped the question, their response would be recorded as the default. I want to require participants to make an active choice.
Is there a way of using the dropdown element so that there is no default response?
See the example code below followed by a sample screen shot.
<surveypage age>/ questions=[1=age] / showquestionnumbers = false </surveypage>
<dropdown age>
/ caption="Age in years:"
/ options=("18 to 25", "26 to 30", "31 to 40", "41 to 50", "51 and over")
/ required=true
</dropdown>

One solution is to combine the validresponse attribute with the options attribute.
Add an empty string or some other descriptive text (e.g., "select option") to the start of the list of options.
copy the set of responses in the validresponse attribute but remove the empty string.
For example:
<surveypage age>/ questions=[1=age] / showquestionnumbers = false </surveypage>
<dropdown age>
/ caption="Age in years:"
/ options=("", "18 to 25", "26 to 30", "31 to 40", "41 to 50", "51 and over")
/ validresponse=("18 to 25", "26 to 30", "31 to 40", "41 to 50", "51 and over")
/ required=true
</dropdown>
The screen will default to this:
and by using the required=true option, participants are not able to skip an item. The question will be displayed in red if participants try to skip.

Related

Long live for a selenium script?

Let's say I have a webpage that I need to have some selenium script to automate the UI testing. This page has a list of sections, in the order of "Section A", "Section B", "Section C", etc. Here is my piece of code to automate the steps on "Section B" area testing.
by = By.CSS_SELECTOR
dropdown_in_SectionB = "#app > div.app > div > div > div.content > div:nth-child(2) > div > div:nth-child(7) > ..."
WebDriverWait(self.driver, 20).until(EC.presence_of_element_located((by, target))).click()
Unfortunately, I can not find a XPATH value for this "drowdown_in_SectionB" area, and I have to use css_selector value here. And it works ok for this second.
But later on, this page has been updated, the updated page now contains "Section A", "SectionX", "Section B", "Section C", in such order. And my above script is broken, as the css_selector value of drowpdown_in_Section becomes:
dropdown_in_SectionB = #app > div.app > div > div > div.content > div:nth-child(2) > div > div:nth-child(8) > ..."
So I have to update the script to have it back to working, which is annoyed.
My question is how may I find a way that the script is smart enough to locate the location in its "css_selector" value, however the change is ?
If it was of XPATH value, I can easily have it solved, as I have other clues to trace the dropdown area in Section, but how this can be done in case of css_selector value ???
Thanks,
Jack

How to change the label name dynamically in vs-tab using vue.js

<vs-tab lable="Kid 1" >
<vs-tab lable="Kid 2" >
and so on...
I made the dynamically add kid and used this like
<vs-tab lable="Kid 1" v-for"(kid,index) in kids>
I mean this lable="Kid{{index+1}} but showing error plz help me out..
You should replace your code to this:
<vs-tab :label="'Kid ' + (index + 1)" v-for"(kid,index) in kids">
And to complete the right answer from #webprogrammer don't forget: for a v-for you need to add a unique key, for instance : :key="index"

Extracting data from div tag

so im scraping data from a website and it has some data in its div tag
like this :
<div class="search-result__title">\nDonald Duck <span>\xa0|\xa0</span>\n<span class="city state" data-city="city, TX;city, TX;city, TX;city, TX" data-state="TX">STATENAME, CITYNAME\n</span>\n</div>,
I want to scrape "Donald Duck" part and state and city name after rel="nofollow"
the site contains a lot of data so name and state are different
the code that i have written is
div = soup.find_all('div', {'class':'search-result__title'})
print (div.string)
this gives me a error
"ResultSet object has no attribute '%s'. You're probably treating a list of items like a single item. Did you call find_all() when you meant to call find()?" % key
first, use .text. Second, find_all() will return a list of elements. You need to specify the index value with either: print (div[0].text), or since you will probably have more than 1 element, just iterate through them
from bs4 import BeautifulSoup
html = '''<div class="search-result__title">\nDonald Duck <span>\xa0|\xa0</span>\n<span class="city state" data-city="city, TX;city, TX;city, TX;city, TX" data-state="TX">STATENAME, CITYNAME\n</span>\n</div>'''
soup = BeautifulSoup(html, 'html.parser')
div = soup.find_all('div', {'class':'search-result__title'})
print (div[0].text)
#OR
for each in div:
print (each.text)

Robot Framework for loop - selector always returning same element

I have an unordered list, from which I need to get the title from each element.
li class="chart-flyout-option" ng-repeat="option in filteredOptions = ($ctrl.options | filter: { value: $ctrl.filterText })" ng-class="{'chart-flyout-option-selected': option.key == $ctrl.selectedOption.key}"><a class="chart-flyout-link" ng-bind-html="option.value | highlight:$ctrl.filterText" title="HERE IS TITLE 1" ng-click="$ctrl.select(option.key, $event)" data-key="126">HERE IS TITLE 1</a></li>
Next element would be similar, but assume - HERE IS TITLE 2
I have a for loop, which looks like this:
Get Flyout Entry Child Links
${numflyoutentries}= Get Number Chart Flyout Entries
${numflyoutentries}= Evaluate ${numflyoutentries} + ${1}
: FOR ${entry} IN RANGE 1 ${numflyoutentries}
\ ${label}= Get Text class:chart-flyout-link
\ Log ${label}
However this only ever returns the text "HERE IS TITLE 1".
Why doesn't my selector increment?

openerp page numbers

I have tried to add page numbers in my document using the following two ways
I just want default page 1, page 2 etc.
1)
<para>
<drawCentredString x="18.5cm" y="1.5cm"> Page: <pageNumber/></drawCentredString></para>
2)
<para><drawCentredString x="18.5cm" y="1.5cm"> Page: <pageCount/></drawCentredString></para>
for option 2, I changed the pagecount class in trml2pdf.py as below
class PageCount(platypus.Flowable):
def draw(self):
self.canv.beginForm("pageCount")
self.canv.setFont("Helvetica", utils.unit_get(str(8)))
## self.canv.drawString(0, 0, str(self.canv.getPageNumber()))
self.canv.drawString(0, 0, str(self.canv._pageCount))
self.canv.endForm()
class PageReset(platypus.Flowable):
def draw(self):
self.canv._pageNumber = 0
--
No Luck !! I just get page : or or
error
Thanks in advance,Usha
You can do so by just writing "< pageNumber/>" in your .rml, but you have to write it under "template/paggeTemplate/pageGraphics" tags.
For example:
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
<pageTemplate>
<pageGraphics>
<drawCentredString x="10.5cm" y="0.8cm">Page: <pageNumber/></drawCentredString>
</pageGraphics>
</pageTemplate>
Hope this will solve your problem.
For the report with header = internal , you will have the 1/2 style page Count in report automatically .
as in report of openerp it is using Numbered canvasing for the internal Heard report .