nateshmbhat / webbot

Web automation library for simple and easy end to end testing and web browser automation that offers super charged features while keeping it simple to use and master
https://pypi.org/project/webbot/
Mozilla Public License 2.0
239 stars 87 forks source link

[Guide] Running a working version of `webbot` #95

Open pidgeon777 opened 4 months ago

pidgeon777 commented 4 months ago

[!WARNING] webbot library is no longer maintained. A fork is available here.

  1. Clone the fork:
git clone https://github.com/KonstantinLitvin/webbot.git
  1. Fix the webbot.py file:
diff --git a/webbot/webbot.py b/webbot/webbot.py
index 5bcbe96..38420a6 100644
--- a/webbot/webbot.py
+++ b/webbot/webbot.py
@@ -297,7 +297,7 @@ class Browser:
             add_to_init_text_matches_score(self.driver.find_elements(By.CSS_SELECTOR, css_selector), 80)

         if xpath:
-            add_to_init_text_matches_score(self.driver.find_elements(By.CSS_SELECTOR, xpath), 100)
+            add_to_init_text_matches_score(self.driver.find_elements(By.XPATH, xpath), 100)

         if not text and tag:
             element_fetch_helper(("//body//{}".format(tag)), score=50)

[!NOTE] By doing so it is possible to call the find_elements function with xpath argument without generating an error.

  1. Install the webbot library:
cd <path/to/webbot>
pip3 install .
  1. Install the latest ChromeDriver version.

pip3 list output:

Package                 Version
----------------------- -----------
attrs                   23.2.0
certifi                 2024.2.2
cffi                    1.16.0
charset-normalizer      3.3.2
h11                     0.14.0
idna                    3.6
outcome                 1.3.0.post0
pip                     23.3.1
pycparser               2.21
PySocks                 1.7.1
requests                2.31.0
selenium                4.17.2
setuptools              68.2.2
sniffio                 1.3.0
sortedcontainers        2.4.0
trio                    0.24.0
trio-websocket          0.11.1
typing_extensions       4.9.0
undetected-chromedriver 3.5.4
urllib3                 2.2.0
webbot                  0.4
websockets              12.0
wheel                   0.41.2
wsproto                 1.2.0

Python version: 3.12.1

Roboxkin commented 4 months ago

Thanks a lot! Thanks to you, now everything has stopped working for me and nothing will start

pidgeon777 commented 4 months ago

Some points:

  1. This guide has been tested on a new (clean) environment and everything worked. I think it is impossible to break everything (?) by just following those steps. The most critical one, for your Python environment, could be the pip3 install . part.
  2. Before doing anything, it is always a good thing to commit/backup. I am not quite sure you did that.
  3. I don't like your attitude. You're stating that "everything has stopped working", but what is "everything"? The search tool? These are simple steps which I don't think will lead to formatting your system.

If you broke something, whatever it means to you, you should at least report exactly what. But if this is your attitude, I don't think I'll spend my time helping.

Sorry!