-3

i am trying to control my browser using python, what I need is I give commands in terminal that should work on the browser like opening and searching for something(like scorling the bowser) and closing the browser

currently I am done with opening the browser and closing

  • 2
    Why do you want to use python, and how are you doing so? Please share your current code by pasting it into the question. It is very easy to open/close browsers and navigate to URLs, etc from the terminal with no python or scripting involved. – C. Peck May 12 '21 at 07:55

2 Answers2

0

yes, you can by using python selenium driver.

This is simple code to test. Also don't forget to download selenium driver. https://chromedriver.chromium.org/downloads

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver = webdriver.Chrome('./chromedriver')
driver.get("https://www.python.org")
print(driver.title)
search_bar = driver.find_element_by_name("q")
search_bar.clear()
search_bar.send_keys("getting started with python")
search_bar.send_keys(Keys.RETURN)
print(driver.current_url)
driver.close()

Read docs in link

0

This is achievable (at least in POSIX systems like Linux or BSD) by using pipes.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/31413306) – PM 77-1 Mar 31 '22 at 16:31