Web browser automation problem

Hi, I want to manipulate the web boozer with selenium python. I brought this up in an other thread with a more vague topic (I dident know about selenium then). Where I was given the advice to use Selenium Python. And got some hope that I could get some assistance from the community here as well. I was overwhelmed by the helpfulness solving librecalc problem (I also learn a lot from this). And also libre calc is kind of involved later down the road in this as well.

What I want to do is a fairly simple (I believe) I want to copy one element from one page and then paste it in the search felled on an other page. And finally hit enter This will also involve separate tabs.

Just to try the principle perhaps we could with selenium open this page:

Best 20 Movies of 2022 - IMDb

Then copy the first titel: “The Batman”

Next open a new tab (google.com) and the past "The Batman” in the search field and hit enter.

I cant use selenium or python but figured that it might be something like this:

driver.get(“Best 20 Movies of 2022 - IMDb”)
driver.maximize_window()
time.sleep(2)

#The CLASS element below corresponds to the title “The Batman”
driver.find_element(By.CLASS,‘lister-item-header’)
action = ActionChains(driver)
action.key_down(Keys.CONTROL).send_keys(‘c’).key_up(Keys.CONTROL).preform()

#Preferably get google in a new tab
driver.get(“https://www.google”)

#‘q’ is the google search field
driver.find_element(by=By.NAME,value=‘q’)
action = ActionChains(driver)
action.key_down(Keys.CONTROL).send_keys(‘v’).key_up(Keys.CONTROL).preform()
action.key(Keys.ENTER).send_keys.preform()

This code dosent work bur it would be interesting to know how to copy and past object between tabs like this! the text that after # is not part of the code off course

And where is LO involved?
In case you didn’t notice, this is not a site dedicated to general Python. You may find here recipes when it comes to write macros for LO in Python vs. Basic, but we never answer questions which are not related, even loosely, with LibreOffice.

It involves librecalc but the first post would be two long if explains the whole package at once. web browser automatisation based on libre calc using Python is possible. And sould be part of the discussion I think. As it’s extremely useful.

The question I make abow is general and my purpous is more to understand the principal. That could bin formulated in a comprehensible context. Context being my example.

You should understand and accept that “manipulating the web browser” is beyond the purpose of this site and probably of the vast majority of contributors. Also, for such a question, citing OS name, LO version and browser name and version is absolutely necessary since “scripting” an application, be it a browser, is very specific due to the variety of engines (and OS interfaces) upon which they are based.

From what I seen using selenium python is the same regardless.

Consider this a general thread discussing webb automation in relation to calc. Its a very interesting topic Im sure and I hope others will agree