TCL 语言的 mixin 类的正确用法是什么?
What is the correct usage of the mixin classs for TCL language?
我正在尝试更新旧版本的 selenium-tcl 包以使用新的 W3C WebDriver(或 Selenium 4.0)。
原始包为 webdriver 使用了一些 mixin class。
所以我对我所看到的进行了建模并创建了一个名为 mixin_action_chains.tcl [1] 的 mixin 文件,其中有一个名为 [=31] 的 mixin class =]Mixin_Action_Chains.
每当我尝试使用它时,我都会收到错误消息:
% package require selenium
::selenium::Mixin_Action_Chains does not refer to an object
我不确定为什么我对它的建模与我在其他文件(例如 mixin_for_scrolling.tcl [2]* 文件中看到的完全一样。我错过了什么。
这里是完整的GitHub Repo
我不确定还必须为 TclOO 做些什么。有什么想法。
谢谢
Im not sure what else must be done for TclOO. Any thoughts.
更新
pkgIndex.tcl: The placement of the mixin-defining script mixin_action_chains.tcl is wrong, it comes after the mixin has already been required in the previously sourced script webdriver.tcl,喜欢直接输入:
% oo::class create C {
mixin ::not::defined
}
::not::defined does not refer to an object
您需要更改 package ifneeded
脚本中 source
命令调用的顺序。
备案
不过,在原始版本中,您的脚本中存在不平衡的花括号和方括号,这导致我无法获取文件:
我正在尝试更新旧版本的 selenium-tcl 包以使用新的 W3C WebDriver(或 Selenium 4.0)。
原始包为 webdriver 使用了一些 mixin class。
所以我对我所看到的进行了建模并创建了一个名为 mixin_action_chains.tcl [1] 的 mixin 文件,其中有一个名为 [=31] 的 mixin class =]Mixin_Action_Chains.
每当我尝试使用它时,我都会收到错误消息:
% package require selenium
::selenium::Mixin_Action_Chains does not refer to an object
我不确定为什么我对它的建模与我在其他文件(例如 mixin_for_scrolling.tcl [2]* 文件中看到的完全一样。我错过了什么。
这里是完整的GitHub Repo
我不确定还必须为 TclOO 做些什么。有什么想法。
谢谢
Im not sure what else must be done for TclOO. Any thoughts.
更新
pkgIndex.tcl: The placement of the mixin-defining script mixin_action_chains.tcl is wrong, it comes after the mixin has already been required in the previously sourced script webdriver.tcl,喜欢直接输入:
% oo::class create C {
mixin ::not::defined
}
::not::defined does not refer to an object
您需要更改 package ifneeded
脚本中 source
命令调用的顺序。
备案
不过,在原始版本中,您的脚本中存在不平衡的花括号和方括号,这导致我无法获取文件: