@cosmin
Thanks for detailed answer. I am stuck on a novice error:
Here is my code:
import os
from pathlib import Path
from RPA.Browser.Selenium import Selenium
from SeleniumLibrary.base import keyword
from selenium import webdriver
class ExtendedSelenium(Selenium):
USER_DATA = Path("output") / "Chrome"
USER_DATA_PATH = os.getenv("USER_DATA", str(USER_DATA)).strip()
@keyword
def open_site(self, url, **kwargs):
print(url)
options = webdriver.ChromeOptions()
if self.USER_DATA_PATH:
options.add_argument(f"user-data-dir={self.USER_DATA_PATH}")
self.open_browser(
url=url,
options=options,
**kwargs
)
selobj = ExtendedSelenium()
selobj.open_site(“webiste url”,browser=‘chrome’)
When i run this:
FileNotFoundError Traceback (most recent call last)
~/.robocorp/holotree/2b7547ee0_12a2bf79/lib/python3.7/site-packages/selenium/webdriver/common/service.py in start(self)
75 stderr=self.log_file,
—> 76 stdin=PIPE)
77 except TypeError:
~/.robocorp/holotree/2b7547ee0_12a2bf79/lib/python3.7/subprocess.py in init(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text)
799 errread, errwrite,
→ 800 restore_signals, start_new_session)
801 except:
~/.robocorp/holotree/2b7547ee0_12a2bf79/lib/python3.7/subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session)
1550 err_msg += ': ’ + repr(err_filename)
→ 1551 raise child_exception_type(errno_num, err_msg, err_filename)
1552 raise child_exception_type(err_msg)
FileNotFoundError: [Errno 2] No such file or directory: ‘chromedriver’: ‘chromedriver’
During handling of the above exception, another exception occurred:
WebDriverException Traceback (most recent call last)
/var/folders/2d/fwpn4y8n5pv1q946ydtzjz100000gn/T/xpython_24808/426359811.py in
1 selobj = ExtendedSelenium()
----> 2 selobj.open_site(“https://www.google.com”,browser=‘chrome’)
3
/var/folders/2d/fwpn4y8n5pv1q946ydtzjz100000gn/T/xpython_24808/1853903439.py in open_site(self, url, **kwargs)
21 url=url,
22 options=options,
—> 23 **kwargs
24 )
25
~/.robocorp/holotree/2b7547ee0_12a2bf79/lib/python3.7/site-packages/SeleniumLibrary/keywords/browsermanagement.py in open_browser(self, url, browser, alias, remote_url, desired_capabilities, ff_profile_dir, options, service_log_path, executable_path)
300 options,
301 service_log_path,
→ 302 executable_path,
303 )
304
~/.robocorp/holotree/2b7547ee0_12a2bf79/lib/python3.7/site-packages/SeleniumLibrary/keywords/browsermanagement.py in _make_new_browser(self, url, browser, alias, remote_url, desired_capabilities, ff_profile_dir, options, service_log_path, executable_path)
329 options,
330 service_log_path,
→ 331 executable_path,
332 )
333 driver = self._wrap_event_firing_webdriver(driver)
~/.robocorp/holotree/2b7547ee0_12a2bf79/lib/python3.7/site-packages/SeleniumLibrary/keywords/browsermanagement.py in _make_driver(self, browser, desired_capabilities, profile_dir, remote, options, service_log_path, executable_path)
721 options=options,
722 service_log_path=service_log_path,
→ 723 executable_path=executable_path,
724 )
725 driver.set_script_timeout(self.ctx.timeout)
~/.robocorp/holotree/2b7547ee0_12a2bf79/lib/python3.7/site-packages/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py in create_driver(self, browser, desired_capabilities, remote_url, profile_dir, options, service_log_path, executable_path)
94 options=options,
95 service_log_path=service_log_path,
—> 96 executable_path=executable_path,
97 )
98
~/.robocorp/holotree/2b7547ee0_12a2bf79/lib/python3.7/site-packages/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py in create_chrome(self, desired_capabilities, remote_url, options, service_log_path, executable_path)
150 service_log_path=service_log_path,
151 executable_path=executable_path,
→ 152 **desired_capabilities,
153 )
154
~/.robocorp/holotree/2b7547ee0_12a2bf79/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py in init(self, executable_path, port, options, service_args, desired_capabilities, service_log_path, chrome_options, keep_alive)
71 service_args=service_args,
72 log_path=service_log_path)
—> 73 self.service.start()
74
75 try:
~/.robocorp/holotree/2b7547ee0_12a2bf79/lib/python3.7/site-packages/selenium/webdriver/common/service.py in start(self)
81 raise WebDriverException(
82 “’%s’ executable needs to be in PATH. %s” % (
—> 83 os.path.basename(self.path), self.start_error_message)
84 )
85 elif err.errno == errno.EACCES:
WebDriverException: Message: ‘chromedriver’ executable needs to be in PATH. Please see ChromeDriver - WebDriver for Chrome
I thought robocorp automatically downloads everything.