[英]python ModuleNotFoundError: No module named 'Common_Methods'
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.我试图检查 pip 中是否有任何该名称的模块,但没有。 I am presently using python version
3.9.0
, I tried switching to 2.7
but the package still seems missing.我目前正在使用 python 版本
3.9.0
,我尝试切换到2.7
但 package 似乎仍然丢失。
EDIT: removing the from Common_Methods.GenericMethods import *
gives the following error:-编辑:
from Common_Methods.GenericMethods import *
会出现以下错误:-
NameError: name 'GenericMethods' is not defined
from Common_Methods.GenericMethods import *
That seems to be a package specific to thier framework you can simply remove it这似乎是特定于他们的框架的 package 你可以简单地删除它
extn = pyautogui.locateOnScreen("absolutepathtofile/icon_16x16.png")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.