I'm trying to use special characters on my dashboard using a HTML structure.
It only works if I use HTML Entities such as "& atilde;" (without space) for ã.
But is it the only way to do it? Is there anywhere I can set UTF-8, for example?
I tried to put a META tag setting UTF-8, but I didn't work.
Here's what I'm doying:
Input:
Output:
I need to type: "Alocação de Funcionários"
Notice that I also set a custom noDataMessage_text on Advanced Properties > Extension points of my first Bar Char and, since the message also have special characters on it, using the HTML Entity would certainly not be a good idea.
UPDATE:
I have the same problem when I was looking for my Cubes when I was using the OLAP Selector Wizard
I think your problem will solve. You can use like these.
<h1 style="font-weight: bold;"> Alocação de Funcionários<h1>
or
<h1 style="color:#297385l"> AlocaÇão de Funcionários</h1>
I got these output in my dashboard.
I am thinking your font family is creating some issue. Please copy the exact h1 tag line and paste it in your dashboard let's see.
Thank you.
Related
The page contains a multi-select dropdown (similar to the one below)
The html code looks like the below:
<div class="button-and-dropdown-div>
<button class="Multi-Select-Button">multi-select button</button>
<div class="dropdown-containing-options>
<label class="dropdown-item">
<input class="checkbox">
"
Name
"
</label>
<label class="dropdown-item">
<input class="checkbox">
"
Address
"
</label>
</div>
After testing in firefox developer tools, I was finally able to figure out the xPath needed in order to get the text for a certain label ...
The below XPath statement will return the the text "Phone"
$x("(//label[#class='dropdown-item'])[4]/text()[2]")
The label contains multiple text items (although it looks like there is just one text object when looking at the UI) in the label element. There are actually two text elements within each label element. The first is always empty, the second contains the actual text (as shown in the below image when observing the element through the Firefox developer tool's console window):
Question:
How do I modify the XPath shown above in order to use in Selenium's FindElement?
Driver.FindElement(By.XPath("?"));
I know how to use the contains tool, but apparently not with more complex XPath statements. I was pretty sure one of the below would work but they did not (develop tool complain of a syntax error):
$x("(//label[#class='dropdown-item' and text()[2][contains(., 'Name')]]")
$x("(//label[#class='dropdown-item' and contains(text()[2], 'Name')]")
I am using the 'contains' in order to avoid white-space conflicts.
Additional for learning purposes (good for XPath debugging):
just in case anyone comes across this who is new to XPath, I wanted to show what the data structure of these label objects looked like. You can explore the data structure of objects within your webpage by using the Firefox Console window within the developer tools (F12). As you can see, the label element contains three sub-items; text which is empty, then the inpput checkbox, then some more text which has the actual text in it (not ideal). In the picture below, you can see the part of the webpage that corresponds to the label data structure.
If you are looking to find the element that contains "Name" given the HTML above, you can use
//label[#class='dropdown-item'][contains(.,'Name')]
So finally got it to work. The Firefox developer environment was correct when it stated there was a syntax problem with the XPath strings.
The following XPath string finally returned the desired result:
$x("//label[#class='dropdown-item' and contains(text()[2], 'Name')]")
I have tried the suggestions provided for other similar questions but they didn't work.
here 2 example:
1) Link: name of your link is changed by QnAMaker during the save and train step in name of your link](https://url.com)) and it is diplayed in the test feature
name of your link](https://url.com))
2) <b> bold text </b> is not changed in bold and the same thing happens with the escaped html
Did you consider markdown? You examples are supported.
Cheatsheet to help you on you way.
Looking to do something relatively straightforward, I'm scraping text which so far I have had no problem grabbing, but I need to keep the <br> tags because white space analysis is an important part of the dataset.
Is there a way to keep the <br> tags so I can turn them into \n\rlater on.
Example:
<p>
<span>Some text.</br></span>
<a>Some more text.<br></a>
<span>Some more more text.<br></span>
</p>
I need : Some text.<br>Some more text.<br>Some more more text.<br>
Right now I get: Some text. Some more text. Some more more text.
Advice?
The only way is to get the html format of your selection , all you have to do is change the column type from Text to HTML , also there is no way to get only the text + the <br>.
I have some dijit.InlineEditBox widgets and now I need to add some search highlighting over them, so I return the results with a span with class="highlight" over the matched words. The resulting code looks like this :
<div id="title_514141" data-dojo-type="dijit.InlineEditBox"
data-dojo-props="editor:\'dijit.form.TextBox\', onFocus:titles.save_old_value,
onChange:titles.save_inline, renderAsHtml:true">Twenty Thousand Leagues <span
class="highlight">Under</span> the Sea</div>
This looks as expected, however, when I start editing the title the added span shows up. How can I make the editor remove the span added so only the text remains ?
In this particular case the titles of the books have no html in them, so some kind of full tag stripping should work, but it would be nice to find a solution (in case of short description field with a dijit.Editor widget perhaps) where the existing html is left in place and only the highlighting span is removed.
Also, if you can suggest a better way to do this (inline editing and word highlighting) please let me know.
Thank you !
How will this affect your displayed content in the editor? It rather depends on the contents you allow into the field - you will need a rich-text editor (huge footprint) to handle html correctly.
These RegExp's will trim away XML tags
this.value = this.displayNode.innerHTML.replace(/<[^>]*>/, " ").replace(/<\/[^>]*>/, '');
Here's a running example of the below code: fiddle
<div id="title_514141" data-dojo-type="dijit.InlineEditBox"
data-dojo-props="editor:\'dijit.form.TextBox\', onFocus:titles.save_old_value,
onChange:titles.save_inline, renderAsHtml:true">Twenty Thousand Leagues <span
class="highlight">Under</span> the Sea
<script type="dojo/method" event="onFocus">
this.value = this.displayNode.innerHTML.
replace(/<[^>]*>/, " ").
replace(/<\/[^>]*>/, '');
this.inherited(arguments);
</script>
</div>
The renderAsHtml attribute only trims 'off one layer', so embedded HTML will still be html afaik. With the above you should be able to 1) override the onFocus handling, 2) set the editable value yourself and 3) call 'old' onFocus method.
Alternatively (as seeing you have allready set 'titles.save_*' in props, use dojo/connect instead of dojo/method - but you need to get there first, sort of say.
I am new to testing and have a question about how can we verify the local language using Selenium. Suppose that I have some link which lets me choose the language, so if I choose a language how can I verify that?
By anything on the page! Let's assume our page is only made of one element, either
<div>
It's time to kick ass and chew bubble gum!
</div>
or
<div>
Il est temps de botter le cul et mâcher de la gomme à bulles!
</div>
Then, with Selenium, you can get the element, get the inner text and verify! Example in Java:
// assuming driver is a good WebDriver instance
WebElement elem = driver.findElement(By.xpath("//div"));
if (elem.getText().contains("kick ass")) {
System.out.println("It's English!");
} else if (elem.getText().contains("botter le cul")) {
System.out.println("It's French!");
}
As of Java 7, you can even use a switch-case on a String, so you can digestedly test against many, many languages.
Well, you can
search for flag of that language on the page
check number formatting, or time formatting (does change in some locales)
Verify some well known text (like greeting) is changed. Say, from Good evening to Dobrý večer (that was in Czech ;) )
We use dictionary files for l10n. Dictionary is an xml file with strings stored like <string key="Cancel">Cancel</string>.
So for testing purposes we replace all </string> with something like ###</string> and replace all spaces between <string key="..."> and </string> with '_' (can be done in notepad++ with ctrl+h, spaces can be replaced with the help of this answer for example). Then we select language that corresponds to modified dictionary at our website. Next step is done by Selenium IDE script: browsing through the whole web site and storing pages' text with the use of Selenium IDE command storeBodyText | text. Then parsing and echo all words that is not ended with ### and analyze if it ok or the word that should be translated is hard-coded. Not pure automation but better than nothing :) I think this approach can be applied not only for xml-dictionary files but for any storage you use for your strings.
PS. If you don't want to perform localization testing but just want to be sure that by clicking on link some language is applied (I'm afraid this is exactly what you are looking for), after you click at your link you can get text from any element and compare it with expected text (storeText(locator, variableName) for IDE).
<!-- Using Selenium IDE -->
<tr>
<td>storeAttribute</td>
<td>//html#lang</td>
<td>language</td>
</tr>
<tr>
<td>echo</td>
<td>The label is ${language}</td>
<td></td>
</tr>