Accessing compound classes in Selenium on Google search results page - selenium-webdriver

I am trying to access the People also ask panel content on the Google search results page for a given search and to extract the question and answer text of the presented questions. However, when I try to access the compound class, with browser.find_elements_by_class_name("_Tgc _s8w _y9e")I get an error and I've tried to fix it by using browser.find_elements_by_class_name("._Tgc._s8w._y9e") but then I get no results? I can't find out how else to access the HTML text, any help is much appreciated! Thank you!

Figured it out, for anyone else who comes across this question:
browser.find_elements_by_xpath("//*[#class='_Tgc _s8w _y9e']")
by using xpath you can reference compound classes

Related

How to manipulate 2sxc/dnn search result titles?

Does anybody have any idea on how to manipulate 2sxc/dnn search result titles?
Something like si.Title ?
Becuase at the moment search results are showing the page title and not the post title.
si.QueryString = "details=" + article.UrlKey;
si.Title = article.Title;
I tried the above code but it does not work.
2sxc doc: https://docs.2sxc.org/api/dot-net/ToSic.Sxc.Search.ISearchItem.html
Hi #BondLookingForAnswers - welcome to StackOverflow :)
I'm not sure if DNN will prefer your title to the page title, but either way I suggest you check out the latest blog app (https://2sxc.org/en/apps/app/blog-app-v4), which customizes the search results, and see where that gets you.
Good luck!

Implementing basic next/previous picture

I'm trying to convert the Adjuster example mentioned here: http://agiletoolkit.org/learn/understand/view/interactive
into a View that is able to show me the next/previous picture of a list of given images.
I guess the number in the example could be an index into an array of pictures.
I'm just not sure how to provide the list of pictures, when all the code is put in init() for the View, so no way to give it the picturelist before that...
Should I use memorize/recall for this list also to prevent it getting lost upon reload ?
is there another example that might help me?
I think you what you are doing can be much easier done with a classic JavaScript Lightbox script. You would supply it list of images and it would show one full-screen.
If not, you can use this:
https://gist.github.com/romaninsh/7217119
This will give you slides similar to the ones on http://agiletech.ie/
Be advised that this code is a little old.

Apple Maps - Find destination/location - How to?

I'm still a noobie to app making, and i've been trying to read some of the documentary for the MapKit, but im still clueless on how to do this.
I have a textfield on TabBar2, and Apple Map on TabBar1.
How do i make the textfield on TabBar2, searchable for destinations like adresses ?
and then show the found destination, on the map on TabBar1 ?
I hope this made some sense.
Thanks in advance
One way to do it is to use MKLocalSearchClass which searches for key words and can be tricked to look for addresses as well. You need to incorporate MKLocalSearchHandler in your class in order to produce the results. You can then add the results in a map view. Apple has a sample code which works basically the same way. It creates a search based on keywords and shows the location of those keywords nearby the users location. For example coffee or movie or etc. the code can be changed to look for a address or anything else you want. Any how here is the link to the sample code, hope it guides you to the right direction.
Map Search Sample Code

Selenium web driver cannot recognize a link text

in one of the web app that I am automating, I find that I came across to some elements that have no ID or class or anything associated, or associated dynamically and won't be able to capture, therefore I have to use link text, for example, "Canada", and then when I do
driver.FindElements(By.LinkText("Canada")).Count > 0 ,
I won't get a "True" although "Canada" is right there. Does anybody came across this before and have any idea why it is?
Thank you!
Use
driver.switchTo().frame("Your LinkText Frame Name");
driver.FindElements(By.LinkText("Canada")).Count > 0 ;
and try.
I think it may work.
Are you sure "Canada" is indeed in a <a> tag ? By.LinkText is meant to search for anchor text
You can certainly create a XPath to search By.xpath. Something like "//*[contains(text(),'Canada')]" (this is the only xpath I can give you without knowing your HTML structure)

Highlightning Keywords in Solr

After tweaking around a lot, I finally decided to post this query of mine. Kindly help!!!
So the query is I want to highlight the search keywords in the result section of the Ajax-Solr.
I tried editing the reuters.js ,reuters.theme.js and Resultwidget.js files, but to no luck.I read that I need to add those keywords in tag , but how to add them is not explained anywhere.
I followed this http://wiki.apache.org/solr/HighlightingParameters but couldnt understand it as it does not explains how to implement it.
Kindly help me.
Thanks

Resources