Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 学习强国.js #174

Open
wants to merge 2 commits into
base: version-14.2
Choose a base branch
from
Open

Conversation

Kleverx
Copy link
Contributor

@Kleverx Kleverx commented Feb 16, 2022

应当尽量少用waitFor(),
当所需控件未出现的时候,程序会保持阻塞。
容易卡死。

.waitFor()当所需控件未出现的时候,会造成程序的阻滞。
应当尽量少用。
}
};
if (endNow == 0) className('android.widget.RadioButton').depth(32).findOnce(optionIndex).click();
slp(1.8);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

slp(1.8)是啥意思呢,sleep()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我直接复制过来的,就是延时函数

*/
function waitForRadioButton(optionIndex) {
var endNow = 0
while(!className('android.widget.RadioButton').depth(32).exists()) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里貌似并没有解决控件因为某种原因没检测出来卡死的原因
如果检测不出来waitFor()会卡死,但你的while循环也退不出来啊
另外这里的depth()不能写死为32,因为挑战答题的是28

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

挑战答题写成28就好了啊。

我写了以后就从来没有卡死过。
因为检测不到radioButton的情况就是答题结束或者控件未出现

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants