未从下拉菜单中选择值

时间:2020-08-17 22:30:17

标签: selenium rselenium

在网站中,我试图从网站顶部显示的下拉列表中选择“英语”语言。我可以打开下拉菜单,但未从下拉菜单中选择值(“英语”)。我非常接近,但似乎缺少一些简单的东西。

#Done Manually:

accuracies <- c(
mean (predictions[,1] == mnist_27$test$y),
mean (predictions[,2] == mnist_27$test$y),
mean (predictions[,3] == mnist_27$test$y),
mean (predictions[,4] == mnist_27$test$y),
mean (predictions[,5] == mnist_27$test$y),
mean (predictions[,6] == mnist_27$test$y),
mean (predictions[,7] == mnist_27$test$y),
mean (predictions[,8] == mnist_27$test$y),
mean (predictions[,9] == mnist_27$test$y),
mean (predictions[,10] == mnist_27$test$y))

#Done with the for loop:

accuracies <- for (i in 1:10) {
  mean (predictions[,i] == mnist_27$test$y)  
}

1 个答案:

答案 0 :(得分:1)

尝试使用此xpath

//*[@id='main-header']//a[@id='idioma-en']/span[normalize-space(contains(text(),'English'))]

Able to select English