Example Browser Launching Chrome, Closing it, then saying it can't find Chrome

I’ve recently started looking into RPA as a method to resolve some production problems, but after installing it with ‘pip install rpaframework’ I’ve been having difficulties getting the example problem to run. I have the following in the IDE:

from RPA.Browser import Browser
br = Browser()
br.open_chrome_browser(“https://www.google.com”)
br.input_text("//input[@name=‘q’]", “robocorp”)
br.screenshot(page=True, locator="//input[@name=‘q’]")

and not only does the import statement throw an error on from (No name ‘Browser’ in module ‘RPA’), the program will successfully open Chrome, immediately close it, and then throw the following error: RPA.Browser.BrowserNotFoundError: No valid browser found from: Chrome

Hi, @preston.lowry!

Let’s try to get this solved.

  • What IDE are you using? Is the IDE using the same Python installation as your command-line?

  • The “browser opens but immediately closes” might happen when the browser is not up-to-date. Worth checking if your browser is the latest available version.

  • It might be just the forum formatting, but I see some “curly quotes” in your pasted example (, ). Curly-ones can cause issues. Try using the normal versions (", ').

  • You can also try open_available_browser instead of open_chrome_browser.

I tried the following in the interactive Python, and it seemed to work ok:

(venv) ~/Projects $ python3
Python 3.7.3 (default, Jun  2 2020, 19:48:59) 
[Clang 11.0.3 (clang-1103.0.32.62)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from RPA.Browser import Browser
>>> br = Browser()
>>> br.open_chrome_browser("https://www.google.com")
1
>>> br.input_text("//input[@name='q']", "robocorp")
>>> br.screenshot(page=True, locator="//input[@name='q']")
>>> br.open_available_browser("https://www.google.com")
2

// Jani

1 Like

Hi Jani! Thanks for responding so quickly!
I’ve been using the VSCode IDE set up for python, and have had no other issues with any previous packages in this manner and it’s the same installation as my commandline. I’ve also checked Chrome’s update status and it is the current version as well. I’ve thrown the a different, but similar error using the Python console as well and have attached it below. It had the same issue where it would open Chrome for just a second, then close it, open it again, close it, and then it would throw this error:

Hi @preston.lowry. What is your Python version ?

I’m using Python 3.8.5(32bit)

thanks - and sorry I forgot to ask what is rpaframework version you are using ? I am trying to reproduce your problem but I haven’t been able thus far.

I am testing now Windows 10, tried different Python versions (also now with 3.8.5) but Chrome opens ok on my tries.

I’m using version 2.6.0 of the RPAFramework. I’ve also had this issue on another device with the same python/framework versions, as well as a Macbook with 3.8.5 of Python as well.

Just collecting more data here:

The unable to find appropriate download for... comes from the webdrivermanager package:

@preston.lowry can you run the following Python script on your computers (you mentioned that you have problems on both MacOS and Windows ?)

The script will create logfile browsertest.log so that we get logs whats is happening when browser is opening Google page. It will also log the Python version and list of installed pip packages in the environment. Also logged are webdrivermanager details about the location of chromedriver. At the end it closes browser.

Can you then send these log files to me on Robocorp Developers Slack (my user is Mika / Robocorp) or by email to mika@robocorp.com.

import logging
import subprocess
from RPA.Browser import Browser
from webdrivermanager import ChromeDriverManager


logging.basicConfig(
    level=logging.DEBUG,
    format="[{%(name)s:%(filename)s:%(lineno)d} %(levelname)s - %(message)s",
    handlers=[logging.FileHandler(filename="browsertest.log", mode="w")],
)

logger = logging.getLogger(__name__)
cdm = ChromeDriverManager()


def runcmd(command, loglabel):
    info = subprocess.run(
        command, shell=True, capture_output=True, universal_newlines=True
    )
    logger.info(f"{loglabel} {info.stdout.strip()}")


runcmd("python --version", "PYTHON VERSION:")
runcmd("pip list", "PIP LIST:\n\n")
logger.info(f"ChromeDriverManager link path: {cdm.link_path}")
logger.info(f"ChromeDriverManager download root: {cdm.download_root}")

br = Browser()
br.open_available_browser("https://www.google.com")
br.close_all_browsers()