Issue
What are the possibilities to retrieve information from selenium (chrome driver) with Python in order to log the information. This is not about web scraping but actually collecting the information which was entered by the user during.
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome('chromedriver.exe')
driver.maximize_window()
driver.get("https://www.google.com")
Lets say now the user types manually in the search box "selenium" and clicks on the "Google Search" button. Is it possible to retrieve this information what the user did in the browser?
Solution
If what you mean is can we use the webdriver instance to fully track all operations done in the browser by the user manually while it was running - the answer is no.
Selenium does not store that information - i.e. it doesn't have a property or method that will return you all entered texts, or clicks, etc. It deals with the DOM of the page in its current state, and communicates with the browser ("return this element/its property", "execute click on this element", etc).
Naturally, you can use it to deduct what the user did - in your example, you can get the state of the input in the Google search and see what's there; or get it from the current url.
But this is site specific (won't be the same on Bing, and is totally inapplicable on a banking site), and will not inform you what she did to get there - you see "cat", but don't know it was "dog" then backspaces then typed the three letters c, a and t; not was it a button click or the keypress Enter.
Answered By - Todor Minakov
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.