Input text doesn't take fractional numbers in Robot Framework - selenium

Input Text //*[#id=${widget}-payment-input-input] 100,999
Click Button id=${widget}-init-payment-button
Wait Until Element Is Visible id=${widget}-payment-input-error-message
Element Should Contain id=${widget}-payment-input-error-message Vous devez saisir un montant.
In the Jenkins job instead of value "100,999", "100999" appears.
Could you advice solutions?

Related

How to select Text from the lookup field after searching particular text in robot framework selenium

I need to select the text entered in a search field. The following robot framework selenium keyword are passed.
Run Keyword And Continue On Failure Input Text xpath: //input[#type='search'] 610-Page
Run Keyword And Continue On Failure Execute JavaScript document.getElementsByClassName('input-group').value = "610-Page";
but when I check the value of the selected field then the output is empty.
Run Keyword And Continue On Failure Element Should Contain xpath: //input[#type='search'] 610-Page
Error I get:
Element 'xpath: //input[#type='search']' should have contained text '610-Page' but its text was ''
Input element won't have text, it will have the value keyword. So if you want to get the text value which is there in the input box then you will have to get the value attribute.

Why value sent to Text box gets disappeared in web application

I am trying to Input text into text box using the Robot framework selenium library and the same gets vanished just after typing. The script passes but the value is not actually passed
input text
//*[text()="Daily Order Limit"]/../../../input 150
I have tried to put more, Click the element and then Input text, Wait until element visible/enabled.
If this the HTML Code of text box element
<input aria-invalid="false" name="limit" placeholder="Daily Order Limit"
type="number" class="MuiInputBase-input MuiOutlinedInput-input" value="">
You can use the below mentioned xpath
Input Text //input[#class='MuiInputBase-input MuiOutlinedInput-input'] 150
OR
Input Text //input[#placeholder='Daily Order Limit'] 150
You see the text getting filled in, but it disappears after typing? Sounds like the page is not fully loaded yet, as in the input is loaded but some ajax/javascript/... refreshes the page. Normaly you wouldn't noticr but Selenium is SO fast that it happens.
Try this:
Sleep 5s
//*[text()="Daily Order Limit"]/../../../input 150
Note that Sleep or hard waits in general are a bad solution. If this works, the next step is figuring out how to detect when the page is REALLY finished loading.

How to input the value of a hidden field into a textbox with Test Cafe Studio?

I am attempting to input the value of a hidden field into a textbox in Testcafe, ideally in some sort of manner that simulates typing. Is there a way to do that? Every time I try to do it via javascript it just throws a javascript error.
Essentially I am testing a pretty standard web app - I fill out a form, go page to page, and then must type in a value that is kept in a hidden html input field on the page. I honestly have no idea where to start - every time I've tried to do this with javascript via the "Run Test Cafe Script" it has thrown a javascript error - I really don't know where to start if javascript can't be used.
TestCafe cannot type text in a zero-size input element. I suggest you try the Run TestCafe Script action with ClientFunction that puts a value to the input element directly:
const setValue = ClientFunction(() => {
document.querySelector('input[type="hidden"]').value = 'John Smith';
});
await setValue();

Identify the xpath to select dropdown in phptravels.net site

I need help to identify the xpath for entering text and select from a dropdown (in https://www.phptravels.net) using Robot framework.
Click on Hotels option
enter text like 'Delhi
enter text like 'Delhi' and select from dropdown the city 'Delhi
Using Robot framework and selenium library.
Input Text xpath://*[#id=\"select2-drop\"] Delhi,India
Input Text xpath://*[#id=\"select2-drop\"]/div/input Delhi,India
Input Text xpath://*[contains(text(),'Search by Hotel or City Name')] Delhi
I get following error:
Element with locator not found
In the case of xpath: [contains(text(),'your_text')] should work.
Try this:
click element xpath=//*[#id="s2id_location"]/a/span[1]
input text xpath=//*[#id="select2-drop"]/div/input Delhi
wait until page contains element xpath=//li[2]/div/span[contains(text(),'Delhi')]
click element xpath=//li[2]/div/span[contains(text(),'Delhi')]
page should contain element xpath=//a/span[1][contains(text(),'Delhi, India')]
Instead of Click element try Press Keys <locator> //13. That would work.

Not able to get tooltip text using Selenium WebDriver

I have 5 tooltips in page. Using WebDriver, I am trying to verify these tooltip text.
I am using following code sequentially to get the tooltip text of all 5 elements:
Actions builder = new Actions(WebDriver);
builder.ClickAndHold(Element1).Perform();
Console.WriteLine(Element1ToolTip.text);
builder.ClickAndHold(Element2).Perform();
Console.WriteLine(Element2ToolTip.text);
builder.ClickAndHold(Element3).Perform();
Console.WriteLine(Element3ToolTip.text);
The issue is I get only the tooltip text of first element printed in console.
Is it because I need to refresh or reset the builder?
It's really weird when I delete the code for 1st element , then I can get tooltip text of 2nd element. So, basically it is getting tooltip text only once in single execution.
Verify tool tip by comparing "title" attribute of the web element and your expected tool tip text.
Console.WriteLine(Element1.GetAttribute("title"));
Console.WriteLine(Element2.GetAttribute("title"));
Tool tip text for input elements would be the title attributes and for images, alt attribute would be the tool tip.This is the standard for HTML 4, so I am not sure if you need to do hover and all.
Console.WriteLine(InputElement1.GetAttribute("title"));
Console.WriteLine(ImageElement1.GetAttribute("alt"));
http://www.javascriptkit.com/howto/toolmsg.shtml
I think, it needs to release from element as:
builder.release(Element1).perform();
So, your code could be as below:
Actions builder = new Actions(WebDriver);
builder.ClickAndHold(Element1).Perform();
Console.WriteLine(Element1ToolTip.text);
builder.release(Element1).perform();
builder.ClickAndHold(Element2).Perform();
Console.WriteLine(Element2ToolTip.text);
builder.release(Element2).perform();
builder.ClickAndHold(Element3).Perform();
Console.WriteLine(Element3ToolTip.text);
builder.release(Element3).perform();
I am facing the same issue , i checked the view source page on running the test and it appears that the title attribute is displayed as data-original-title.Due to which it is unable to display the text.On replacing the title with data-original-title . I am able to obtain text.