1

I asked a similar question about how to edit a web page with Python before using selenium, but since that didn't get anywhere (I want to be able to do it in a browser that still has all of the saved cookies, passwords, bookmarks, etc) I want to broaden the scope. Using any modules you know of, how can I open a website in my browser, and edit an element using a Python script?

For instance I'd like my script to do something like this...

open google.com
find the element that corresponds to the google logo
hide the element

If it helps, I'm on a Macbook, using Google Chrome

2 Answers 2

0

You can still do that via selenium, locate the element and edit the style via "execute script":

elm = driver.find_element_by_id("myid")
driver.execute_script("arguments[0].style.display = 'none';", elm)
Sign up to request clarification or add additional context in comments.

1 Comment

Right, but when I use selenium I lose all of those bookmarks, passwords, and cookies that I mentioned in the post
0

to open google we can use :

    import webbrowser
    webbrowser.chrome("url to open")

I dont know for others.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.