Is it possible to make a script that compute a "ctrl F"?
I have a list of societies. I want to get (for exemple) the values of those societies.
For each society of my list my script:
- go on google
- type the name of the society
- click on search
- go to the first url
And now, I am on the good website.
I want to go through all the pages and look for the word "value" (= do a ctrl F) to collect a list of word behind...
The idea is to get the list of values of each society...
You can achieve what you want with an xpath selector.
In this SO topic you can see how you can use xpath selectors with beautifulsoup.
The xpath expression to search for the text "value" would be something like:
//*[text()="value"]
If you need to improve this expression, refer to this great guide about xpath expressions.
Related
I apologize if this is a duplicate of a question already but nothing I read seemed to do the trick.
I am trying to automate the process of adding my hours for my job. This entails using selenium to mimic the process I do to enter the hours for me.
The problem is, as I navigate through the process, I have run into an instance where one of the elements has a dynamic id and xpath (any maybe other things. I am not very proficient in HTML).
I need to select the "Day" button on the "View" drop down. The highlighted HTML corresponds to that button. I have already checked and both the ID and Xpath change every time I create a new session. I usually do the following to find my elements:
elem = driver.find_element_by_xpath('xpath')
Below is the xpath I currently see:
//*[#id="ab5378a9418345a2a57ad12f066127a6"]
To further complicate things, the xpath for the "Week" selection is the following:
//*[#id="741015164c5547fbb5403c03c46636d3"]
I tried to figure out how to use "contains" with the xpath but even so, the two are not different enough to differentiate by using "#id". The only constant thing and difference I see each time is that the
data-automation-label="Day"
is present on the day element and
data-automation-label="Week"
is present on the week element.
Does anyone have any experience finding the elements when a problem like such occurs? I am working in Python3.6 on a windows 7 computer.
Again, I apologize if this is a duplicate but I tried very hard to find an answer before coming here for help.
Thanks in advance!
You can use two of the below possible selectors
XPATH
//div[#data-automation-label="Day"]
CSS
div[data-automation-label="Day"]
When you use identifier your main focus should be how to find something that is unique to that object. And it really doesn't matter if it is name or id or what not. Use what you think would work the best. And here data-automation-label implies that itself
I want to add bullets in featured snippet. When i search for 'gastric balloon' in google it gives me featured snippet for this link www.bariatric-surgery-source.com/gastric-balloon.html as shows in below image :
PLEASE OPEN THIS IMAGE => https://i.stack.imgur.com/1MBoD.png .
I have marked those lines with red color i.e i want to make display them with bullets symbol instead of plain text.
Someone suggest me that it could be possible with structured data but how?
And which code i have to write and where?
You have done everything semantically, so I would make the assumption that Google will strip out any formatting, and apply their own.
Best thing you could do is mark it up with ListItem schema.
An list item, e.g. a step in a checklist or how-to description.
Source - https://schema.org/ListItem
I´d like to implement something like a store finder by ZIP-code in my TYPO3 website. I know there are Extensions that let users enter a ZIP-code/adress and find the nearest location but that's not what I´m after.
We deliver to our customers and follow fixed delivery plans. I want a user to enter his ZIP-code and the website should answer with one (or more) snippets with the delivery tables for the matching driver (or drivers).
TD;DR How do I search a multitude of content elements in TYPO3 and display only those with matching substrings?
Maybee just use Content Object "CONTENT" and use "select" in Typoscript:
https://docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/Content/Index.html
And write your own select statement like:
"where = (title LIKE '%ZIP%')"
https://docs.typo3.org/typo3cms/TyposcriptReference/Functions/Select/Index.html
An example, in german, but you will understand the typoscript part:
http://www.typo3wizard.com/de/artikel/das-content-objekt.html
I want to have a search box on top of the header, but when I submit keywords, I dont want the results to appear on the header, but on the body.
To do this, I thought id have the plugin once in the header and another in the body in a special "Search" page, where I could hide the from in the header when the user was using this page. But I dont know how to do, so that when a search is done, to jump to this other page. (Its sort of like when tt_news has a single pid to go from LIST to SINGLE)
How can I do it to do this jump? Or maybe is there an easier way to achieve what I want?
On common pages you need to construct "pure html" in the header part with the search form where its action is link to the another page - displaying search results. It uses typolink for generating proper form's action.
On the page with search results you don't need to hide the search form, instead you can use TypoScript to fill the search field with value entered on the common page.
There is ready-to-use sample of TypoScript for such scenario placed in Introduction Package, I don't use it so sorry, but I won't paste it here. Anyway you can install it locally and dig for nice snippets and techniques.
In SharePoint Designer I use some lists as sources and then link them together with an operation GetListItems (I fetch items from multiple lists on different site collections for rollup/aggregation):
alt text http://img151.imageshack.us/img151/1807/ss20090428101310.png
Now something is fine as I managed to get the result: alt text http://img410.imageshack.us/img410/4835/ss20090428101013.png
But the strings that are attached to field result (6;#, 2;#) is... disturbing.
How can I get rid from those attached strings? They are not attached to all fields, but to some (important ones):
alt text http://img168.imageshack.us/img168/1647/ss20090428100732.png
Ahh, well usally that happens - you keep searching for answer, then seek for help and find it yourself.
I used substring xsl function, to strip away those first characters. Messy, if i want to add links to that table, but works.
alt text http://img2.imageshack.us/img2/3117/ss20090428102714.png
By the way, the main question how to rollup content from multiple site collections has been journey to me for several days already. If anyone is in the same situation, I recommend (well because I found myself an answer there) these:
How-To Rollup two lists in two site
collections on a page
Or a better way to use for a single
site collection: SharePoint
Customisation Tricks: Use The
SPDataSource, Luke! (Good links
inside that article).
Something I didn't touch, because I
didn't need such an advanced method,
but maybe someone does: Populating
data sources in code