-1

I am trying to follow this example of generating a click on the extension. below is my code

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
import pyautogui
import json
import os
from Common_Methods.GenericMethods import *

options = webdriver.ChromeOptions()
options.add_argument("--load-extension=./Edit-This-Cookie")
driver = webdriver.Chrome(ChromeDriverManager().install(), chrome_options=options)

driver.get("https://google.com")
# get the extension box
extn = pyautogui.locateOnScreen(os.path.join(GenericMethods.get_full_path_to_folder() + "/icon_16x16.png"))
# click on extension 
pyautogui.click(x=extn[0],y=extn[1],clicks=1,interval=0.0,button="left")

I am getting the error

    from Common_Methods.GenericMethods import *
    ModuleNotFoundError: No module named 'Common_Methods'

I tried to check if there is any module by that name in pip, but there are none. I am presently using python version 3.9.0, I tried switching to 2.7 but the package still seems missing.

EDIT: removing the from Common_Methods.GenericMethods import * gives the following error:-

NameError: name 'GenericMethods' is not defined
isnvi23h4
  • 1,910
  • 1
  • 27
  • 45
  • not sure what you need that module for, if you cant find how to install it, you possibly have to take a another module that you can install, since for everything there are mostly multiple solutions – Timeler Nov 30 '20 at 13:32
  • @Timeler not sure if you can.see that GenericMethods is needed in the path – isnvi23h4 Nov 30 '20 at 13:33
  • i can see it, but again if that module doesnt seem to exist, which seems to be the non-existant, you have to find another solution as @PDHide said – Timeler Nov 30 '20 at 13:34

1 Answers1

0
from Common_Methods.GenericMethods import *

That seems to be a package specific to thier framework you can simply remove it

extn = pyautogui.locateOnScreen("absolutepathtofile/icon_16x16.png")
PDHide
  • 18,113
  • 2
  • 31
  • 46
  • removing that package impot throws error for genericmethod. Please check the edit – isnvi23h4 Nov 30 '20 at 13:30
  • @souparnomajumder don't simply copy paste code find alternative of what the are trying to do , like usiong python path or something – PDHide Nov 30 '20 at 13:31
  • @souparnomajumder just provided full path instead of calling the generic method . Give full path to the image file – PDHide Nov 30 '20 at 13:44