I have to create a test script in Selenium which found and click correct link in google search engine.
Script should open google website later enter searched phrase (for example: "ipod blog") later should in results on current page search correct item (for this example: "iPadOS: iOS Blog") when it wouldn't be presented on this page should automatically press "Next page button" and go to next page to moment when correct item will be found (in my case that item is on 21st page of results in google). When element will be found script should stored in log number of page where this item was found.
Can anybody help with this or give any useful tips.
I know how to create this script step by step but I haven't any idea how to create loop for searching correct phrase on google pages and later executed next.
Related
I am trying to find out solution of this from so many days and couldn't find any solution of this please help me with the solution.
I am using popup overlay of Google CSE. I am using only allowing few sites to show the search results.
If search result is available then it shows like this = https://prnt.sc/qAt0KbTVPNb7
If search result is not available then it shows like this type of empty result interface = https://prnt.sc/WnaeQ6_7yyPF
I want this to automatically trigger close button if no search result is exist.
How can I do this? Please help me with this :(
I am trying to click on the Financials link of the following URL using Selenium and Python.
https://www.marketscreener.com/DOLLAR-GENERAL-CORPORATIO-5699818/
initially I used the following code
link = driver.find_element_by_link_text('Financials')
link.click()
Sometimes this works and sometimes it doesn't and I get the Element is not Clickable at point (X,Y) error. I have added code to maximise the webpage in case the link was getting overlapped by something.
It seems that the error is because the webpage doesn't always load in time. To overcome this I have been trying to use expected conditions and wait libraries of Selenium.
I came up with the following but it isn't working, I just get TimeoutException.
link = wait(driver, 60).until(EC.element_to_be_clickable((By.XPATH,'//*[#id="zbCenter"]/div/span/table[3]/tbody/tr/td/table/tbody/tr/td[8]/nobr/a/b')))
link.click()
I think XPATH is probably the best choice here or perhaps class name, but there is no ID. I'm not sure if its because the link is inside some table that it isn't working, but it seems odd to me that sometimes it works without having to wait at all.
I have tried Jacob's approach. The problem is I want it to be dynamic so it will work for other companies. Also, when I first land on the summary page the URL has other things at the end so I can't just append /financials to the URL.
This is the URL it gives me: https://www.marketscreener.com/DOLLAR-GENERAL-CORPORATIO-5699818/?type_recherche=rapide&mots=DG
I might have find a way around this:
link = driver.current_url.split('?')[0]
How do I then access this list item and append the string 'financial/' to the list item?
I was looking for a solution when I noticed that clicking on the financial tab takes you to a new URL. In this case I think the simplest solution is just to use the .get() method for that URL.
i.e.
driver.get('https://www.marketscreener.com/DOLLAR-GENERAL-CORPORATIO-5699818/financials/')
This will always take you directly to the financial page! Hope this helps.
Is there any way to find out current page number in search complete callback function of google image search api?
I have defined a function for search complete callback and set it using this setSearchCompleteCallback and found that it is called for each page click also, so is there any way to know what is the current page number?
Found a workaround, the div for current page has css class
gsc-cursor-current-page
This is not what exactly what I asked in the question but it helped me!
I am working on a project to analyze HTML code from specific websites. I can use phantomjs to get the source of a single website, but what I'd like to do is be able to get the source for many websites using a search term.
Say I search "Music CD's" on Google. I'd like the application to click on a result, save the source then click on the next result and save the source. Also I'd like it to be able to navigate to the next page and do the same on all subsequent pages.
Any advice on tools that may help with this, or guidance on how I can program it myself would be greatly appreciated.
On my search results page I would like to display the phrase that the user searched for.
For example, instead of using the title Search Results: as you can see in the screenshot, I would instead like to use the title Search Results for vitae:
Is it possible to pull in the searched word/s?
At present the title is hard coded within the web part container that surrounds the search results web part.
Screenshot of search results currently:
I have had a response back from Kentico about how to do this. See solution below.
Your Search Results: text is filled probably in the Container title
property of your smart search web part, so please just change it to
the following one:
Search Results for {?searchtext?}:
This works perfectly! {?searchtext?} pulls in the searched word.