简体   繁体   English

参数数量错误或uft中的属性分配无效

[英]Wrong number of arguments or invalid property assignment in uft

Thanks in Advance :) I can get the row count but not the column count using columncount method in uft 12.2. 在此先感谢:)我可以在uft 12.2中使用columncount方法获取行数,但不能获取列数。 It simples throws an error at AccNoCol=AccNoTB.ColumnCount Wrong number of arguments or invalid property assignment: 'AccNoTB.ColumnCount'. 它很AccNoCol=AccNoTB.ColumnCountAccNoCol=AccNoTB.ColumnCountAccNoCol=AccNoTB.ColumnCount错误。参数数量错误或属性分配无效:'AccNoTB.ColumnCount'。 I know the column count is 8 here however they are dynamic & there is a risk to hard code the column count in script. 我知道这里的列数是8,但是它们是动态的,存在在脚本中硬编码列数的风险。 Could you plz point out the correct? 您能指出正确的吗? Thanks again 再次感谢

Set AccNoTB=browser("title:=.*").page("title:=.*").webtable("column names:=;Account No;Account Name;Billing City;Website;Phone;Assigned To;Action","cols:=8")

AccNoRow=AccNoTB.RowCount

AccNoCol=AccNoTB.ColumnCount

AccTBvalue=AccNoTB.GetCellData(AccNoRow,AccNoCol)

MsgBox AccTBvalue`

The column count of each row in the WebTable can differ therefore ColumnCount requires a parameter to specify to UFT which row's column count you're interested in. WebTable中每一行的列数可以不同,因此ColumnCount需要一个参数来向UFT指定您感兴趣的行数。

 A row can have <table border=1> <tr><td>One</td></tr> <tr><td>or</td><td>two</td></tr> <tr><td>or</td><td>even</td><td>more</td></tr> </table> Columns 

Two simple ways to get Row and Column counts. 获得行数数的两种简单方法。

Note that I've removed "cols:=8" from object description, assuming the WebTablt is getting identified by column names . 请注意,假设WebTablt由column names标识,我从对象描述中删除了"cols:=8"

Set AccNoTB=browser("title:=.*").page("title:=.*").webtable("column names:=;Account No;Account Name;Billing City;Website;Phone;Assigned To;Action")

Two ways to get Rows count 获取行数的两种方法

AccNoRow = AccNoTB.GetROProperty("rows")    '<-- 1
AccNoRow = AccNoTB.RowCount                 '<-- 2

Two ways to get Column count 获得列数的两种方法

AccNoCol = AccNoTB.GetROProperty("cols")    '<-- 1
iRow = 2
AccNoCol = AccNoTB.ColumnCount(iRow)        '<-- 2 This way is useful when you have different columns in different rows.

Now lets take the example that @Motti have given. 现在让我们以@Motti给出的示例为例。 In this case we'll run a loop and get the column count. 在这种情况下,我们将运行一个循环并获取列数。

Set AccNoTB=browser("title:=.*").page("title:=.*").webtable("column names:=;Account No;Account Name;Billing City;Website;Phone;Assigned To;Action")
AccNoRow = AccNoTB.RowCount

For i = 1 To AccNoRow
    AccNoCol = AccNoTB.ColumnCount(i)
    Print "Row " & i & " has " && " column/s."
Next

Output: 输出:

Row 1 has 1 column/s.
Row 2 has 2 column/s.
Row 3 has 3 column/s.
set a=Browser("OrangeHRM").Page("OrangeHRM_2").WebTable("micclass:=WebTable","html tag:=TABLE")

co=a.RowCount

MsgBox co
'set b=Browser("OrangeHRM").Page("OrangeHRM_2").WebTable("micclass:=WebTable","html tag:=TABLE")

col=b.ColumnCount

MsgBox col

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Access DB上SQL ISNULL()的参数数量错误 - Wrong number of arguments with SQL ISNULL() on Access DB 泛型使用了错误的参数数量错误? - generic was used with wrong number of arguments error? 将集合与WebBrowser控件和ObjectForScripting一起使用时,“无效的属性分配” - “invalid property assignment” when using a collection with the WebBrowser control and ObjectForScripting 有没有更好的方法来调试“调用中错误的数字或类型的参数”错误? - Is there a better way to debug “wrong number or types of arguments in call” errors? Oracle存储过程PLS-00306:错误的参数数量或类型 - Oracle Stored Procedure PLS-00306: wrong number or types of arguments ORA-06550:PLS-00306:呼叫中参数的数量或类型错误; ORA-06550: - ORA-06550:PLS-00306: wrong number or types of arguments in call;ORA-06550: 拦截属性赋值以捕获InvalidCastException - Intercept property assignment to catch InvalidCastException 等于删除等于里面的错误分配 - Equals Remove wrong assignment inside Equals .NET - 查找属性赋值的所有引用 - .NET - Find all references of property assignment 没有可访问的“ New”接受此数目的参数 - No accessible 'New' accepts this number of arguments
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM