I want to extract text "External ID" from the following HTML:
External ID
writing the following XPath gives me an error as :AttributeError: 'str' object has no attribute 'Text'
searchElement = "//[#name='options']//[#class='dropdown-select-inner ng-star-inserted']"
searchElement.getattribute("Text")
I tried writing with
searchElement.text as well, but it did not work.
Can you please help me on it.
Thanks in advance
Related
Currently my 'yield' in my scrapy spider looks as follows :
yield {
'hreflink':mylink,
'Parentlink':response.url
}
This returns me a dict
{
'hreflink':"https://www.southeasthealth.org/wp-content/uploads/Southeast-Health-Standard-Charges-2022.xlsx",
'Parentlink': "https://www.southeasthealth.org/financial-information-price-transparency/"
}
Now, I also want the 'text' that is associated with this particular hreflink, in that particular Parentlink. So my final output should look like
{
'hreflink':"https://www.southeasthealth.org/wp-content/uploads/Southeast-Health-Standard-Charges-2022.xlsx",
'Parentlink': "https://www.southeasthealth.org/financial-information-price-transparency/",
'Yourtext' : "Download Pricing Info"
}
What would be the simplest way to achieve that. I want to use Xpath expressions to get the "text" in a parentlink where href element = #href .
So far Here is what I tied -
Yourtext = response.xpath('//a[#href='+json.dumps(each)+']//text()').get()
but its not printing anything. I tried printing my response and it returns the right page - 'https://www.southeasthealth.org/financial-information-price-transparency/'
If I understand you correctly you want to get the text belonging to the link Download Pricing Info.
I suggest you try using:
response.xpath("//span[#class='fusion-button-text']//text()").get()
I found the answer to my question.
'//a[#href='+json.dumps(each)+']//text()'
This is the correct expression however the href link 'each' is case sensitive and it needs to match exactly for this Xpath to work.
I'm grabbing the following page and storing it in R with the following code:
gQuery <- getURL("https://www.google.com/#q=mcdimalds")
Within this, there's the following snippet of code
Showing results for</span> <a class="spell" href="/search?rlz=1C1CHZL_enUS743US743&q=mcdonalds&spell=1&sa=X&ved=0ahUKEwj9koqPx_TTAhUKLSYKHRWfDlYQvwUIIygA"><b><i>mcdonalds</i></b></a>
Everything other than "showing results for" and the italics tags encasing the desired name for extraction are subject to change from query to query.
What I want to do is extract the mcdonalds out of this string using regex that occurs here: <b><i>mcdonalds</i> aka the second instance of mcdonalds. However, I'm not too sure how to write the regex to do so.
Any help accomplishing this would be greatly appreciated. As always, please let me know if any additional information should be added to clarify the question.
I want to input username.
I have tried to find element as below using UIatomator but it throwing error.
Input Text xpath("//android.widget.EditText[#resourse-id='name']") test
I have attached screenshot for reference please help..please suggest
You are using the wrong syntax for xpath. The syntax is:
Input Text xpath=//android.widget.EditText[#resource-id='name']
The format is described in the Selenium2Library documentation, under the section "Locating or Specifying Elements"
Try like this:
xpath = "//*[#resource-id='name']/android.widget.EditText"
I believe it solves your problem.
I have a file with locators which I import in my test suite. The file has lines like these:
LOCATOR_ABC='id=abc'
LOCATOR_XYX='id=xyz'
I have another file which contains locator variable names and expected values, so something like this:
LOCATOR_ABC¤hello world
LOCATOR_XYZ¤goodbye world
Now I want to loop through the latter file and do something like this for each line:
${locator}= Fetch From Left ${line} ¤
${value}= Fetch From Right ${line} ¤
${ui_value}= Get Text ${${locator}}
... compare value and ui_value and expect them to match ....
The problem is I get the error:
Variable '${?LOCATOR_ABC}' not found. Did you mean:
${LOCATOR_ABC}
I know the part with ${${locator}} is probably not nice/correct, but changing my setup so the locator¤value file has lines like this:
${LOCATOR_ABC}¤hello world
${LOCATOR_XYZ}¤goodbye world
And then use this in my test instead:
${ui_value}= Get Text ${locator}
The error message is:
ValueError: Element locator '?${LOCATOR_ABC}' did not match any elements.
So I guess my question is if anyone can shed some light on the ? part of the error message? What am I doing wrong? And or is there another/better way to do this?
Problem with file encoding. Changing to ascii encoding solved the problem.
I need to extract to clipboard activation link, link every registration changed.
HTML Code:
Try something like this code:
SEARCH SOURCE=REGEXP:"(http://mctop.me/approve/\w+)" EXTRACT=$1
SET !CLIPBOARD {{!EXTRACT}}
Error -1200: parses "(http://mctop.me/approve/\w+)" - Unrecognized esc-sequence \w.