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']
Related
The text I'm searching for is all contained within a CSS class called "content-center", and within that is a series of CSS classes all with the same name that old similar, but different information. It seems to only be returning [<JSHandle preview=JSHandle#node>] rather than returning the text itself as if saying "yes, this text is on the page X times".
page.wait_for_selector('.content-center')
print(page.query_selector_all(".content-center:has-text('Bob Johnson')"))
page.query_selector_all returns the ElementHandle[] values of the elements which got found. Over these you can loop and call the text_content() method to get the text out of that specific element.
Also in most cases, its enough to use the text-selectors to verify something is on the page or an element has text, see here for reference.
I'm writing automation tests for a windows application using Sikuli/Robotframework, I want to be able to validate text that I see on the application but the values change so would be using a variable created at the start of each test run, is there anyway to validate that the text value is present in the application using Sikuli if not where should I look for validation?
I just had a look at SikuliLibrary
There is a Keyword called "Get Text" where it returns the text when an image file is passed. You can then store it in a variable and then make use of String comparison operation.
Get text - from library
Two ways in which you can retrieve text.
If image is not given, keyword will get text from whole Screen
If image is given, keyword will get text from matched region Call keyword setOcrTextRead to set OcrTextRead as true, before using text recognition keywords.
Examples:
Set Ocr Text Read true
Get Text
Get Text test.png
String comparison operation
Should be equal as strings ${only value} ${sele}
I have the xpath from inspecting the element in chrome:
//*[#id="p_0"]/table/tbody/tr[2]/td[2]/input
But the same when I am passing in my robotframework code doesn't pick the XPath.
I tried giving the above mentioned xpath as:
xpath=//input[#id='p_0']/table/tbody/tr[2]/td[2]
This particular code gives me error as element not found
The XPath you tried with is different than what inspect returned - the inspect value starts with //*[#id='p_0'], i.e. "whatever node name with that id", while yours is //input[#id='p_0'] - "an input element with that id"; change the "input" to star.
The other thing is the locator's end/suffix - the one from the inspect ends at the "input" tag, while yours at the table cell; append the /input if you're targeting that element.
I am a newbie but keen into test automation. Please don't hesitate to send and reply ANY hints you have.
So the problem is that I've faced a web page where there is input field but there is no ID for it in source. Input field has type=text AND that input field is THE ONLY on that page. I have not been able to locate that element with Robot Framework (+PyCharm) but I have a feeling that it should be possible some way in Xpath? Please help me.
Using Input Text xpath=//INPUT[#type='text'] test -> gives this error:
"InvalidElementStateException: Message: invalid element state:
Element is not currently interactable and may not be manipulated"
I am afraid that the ancient framework used in system under test is the problem. It's called GWT-ext and in many cases there exists id for element but it's generated randomly every time so that cannot be used as locator of the element. That's why I need to use other ways, like field names, types etc.
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