简体   繁体   English

Eclipse - 调试

[英]Eclipse - Debugging

I am very new to Selenium and Eclipse.我对 Selenium 和 Eclipse 很陌生。 I have a question (actually 2 questions) about debugging.我有一个关于调试的问题(实际上是 2 个问题)。

  1. When I am debugging in Eclipse (Version: 2021-06 (4.20.0)), so I do not get visibility of all variables I have defined in the method.当我在 Eclipse 中调试时(版本:2021-06 (4.20.0)),所以我看不到我在方法中定义的所有变量。

在此处输入图片说明

For example, (see the screen shot attached) I have added string variable testSigned and assigned a value to it.例如,(参见附上的屏幕截图)我添加了字符串变量 testSigned 并为其分配了一个值。 Actually the purpose is to verify the text value contained in web element table_AdditionalDocumentation.其实目的是验证web元素table_AdditionalDocumentation中包含的文本值。 I defined Toggle Line breakpoint at line 395. I started to execute in debug mode, got to the line 395. However, I do not see the value of testSigned in Variables tab.我在第 395 行定义了 Toggle Line 断点。我开始在调试模式下执行,到达第 395 行。但是,我在 Variables 选项卡中没有看到 testSigned 的值。 I noticed it does show values only of the variable which would be returned by the method, correct me if I am wrong.我注意到它只显示方法返回的变量的值,如果我错了,请纠正我。
Please, tell me how to get those values I have defined visible.请告诉我如何让我定义的那些值可见。

2.Additionally, please, let me know which button to press if for example after line 395 I want not to go line by line (F6), but just to run the code to the end. 2.此外,如果例如在第 395 行之后我不想逐行 (F6),而只想将代码运行到最后,请告诉我要按哪个按钮。

For the first question, I'm not certain, but it might be because you haven't initialized that variable with a value.对于第一个问题,我不确定,但这可能是因为您尚未使用值初始化该变量。 Try setting it to an empty string on the declaration line.尝试在声明行将其设置为空字符串。

For the second question, if you set a breakpoint on the line you want to get to, just Resume (F8), and it will stop at the next breakpoint it hits, hopefully the one at the end of your method.对于第二个问题,如果您在想要到达的行上设置断点,只需继续(F8),它将在它遇到的下一个断点处停止,希望是方法末尾的断点。 Alternatively, if you just want to stop at the line right after the method returns (which will show the return value), you can click "Step Out" (F7) for that.或者,如果您只想在方法返回后立即停在该行(将显示返回值),您可以单击“Step Out”(F7)。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM