data-translate in data-bind not working - data-binding

I am a newbie to knockout.js. I am having a problem. I am trying to translate the windowTitle in my html but I am getting an error. I can see the the window title when I do console.log(data.windowTitle); but i also get the following error in my console
Error: Unable to parse bindings. Message: SyntaxError: missing : after property id; Bindings value: attr{data-translate:windowTitle}
That is how I am trying to do my job
<span data-bind="attr:{data-translate:windowTitle}"></span>

The data-translate is not a valid javascript identifier. You need to wrap the identifier name in quotes ('') to make it work
<span data-bind="attr:{ 'data-translate' :windowTitle}"></span>
See also in the documentation: Applying attributes whose names aren’t legal JavaScript variable names

Related

How do I get hidden text from text field by robotframework

I used this statement but got error
${searchbox_title} Get Text //form[#role='search']//input[#aria-label='ค้นหาใน เสื้อผ้าแฟชั่นผู้ชาย']
Error msg
Element with locator '//form[#role='search']//input[#aria-label='ค้นหาใน เสื้อผ้าแฟชั่นผู้ชาย']' not found.
You seem to be trying to get the value from a dynamic element. The input field has that content after being written by the user or robot. Why not trying a different locator, for example:
//form[#role='search']/input[#class='shopee-searchbar-input___input']

I want to check if a div has a specific ID and class robot framework

I want to check if the page contains an element with a specific id and a class:
${is_court_selected}= Run Keyword And Return Status Wait Until Page Contains Element //div[#id="card_for_court_${position_1}",contains(#class,'selected_court_subtab_courts')] ${TIMEOUT AJAX}
I get the following error code:
InvalidSelectorException: Message: Given xpath expression "//div[#id="card_for_court_15",contains(#class,'selected_court_subtab_courts')]" is invalid: SyntaxError: The expression is not a legal expression.
At least add first locator strategy: xpath: //div[#id="card_for_court_${position_1}",contains(#class,'selected_court_subtab_courts')]
also you might need to replace the ,in xpath by and:
xpath: //div[#id="card_for_court_${position_1}" and contains(#class,'selected_court_subtab_courts')]

use of "Execute Javascript" Selenium2Library to retrieve value

Using the below script to retrieve value by passing WebElement as argument in javascript:
${elem}=Get WebElement name=productField
${value}=Execute Javascript return document.arguments[0].value,'${elem}';
Log To Console ${value}
Seeing the below error:
WebDriverException: Message: unknown error: Cannot read property '0' of undefined
In the SeleniumLibrary documentation there are two keywords that useful in this situation: Get Text and Get Value. Both take your identifier as input and return the desired text.
${text}= Get Text name=productField
${value}= Get Value name=productField
So, there is no need to use javascript for this.

In Google Tag Manager, getting, "Expected a string value for field: "contentGroup1". but found: "object"

I'm trying to set up a content grouping. WordPress is pushing the blog tags into the data layer as pageAttributes. I've got a custom data layer variable in GTM reading this and labeled as blogTagsArray. I used this variable in a tag to set up the content grouping, firing on blog pages. When I debug, everything is firing, but I get an error message:
Expected a string value for field: "contentGroup1". but found: "object".
Is there a second step I need to take to convert the object into a string? Or is there something I can do in this step to correct this?

Spring locale resolver - regex within .properties key

I want to use regex within my properties message key, like below
message.errorCode.^(\\5[0-9]{3})$ = Internal Error
but doing so throws an exception
javax.servlet.jsp.JspTagException: No message found under code 'message.errorCode.5000' for locale 'en'.
I want to avoid checking error code range before reading .properties label. Kindly suggest if there's a way to achieve so through regular expressions in .properties files.

Resources