水豚-我必须单击水豚按钮,但他找不到

时间:2019-12-04 12:59:43

标签: capybara

<button _ngcontent-c50="" class="mat-menu-item ng-star-inserted" mat-menu-item="" role="menuitem" tabindex="0" aria-disabled="false"> 11 - teste <div class="mat-menu-ripple mat-ripple" matripple=""></div></button>

代码水豚, 经过测试

browser.find('button', text: ' 11 - teste ').click
find_button(' 11 - teste ')
find('#button.mat-menu-item').click 

2 个答案:

答案 0 :(得分:1)

有了该HTML,您应该就可以使用

import pygame

finish = False
while not finish:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            finish = True
        if event.type == pygame.KEYDOWN:
            if event.key == pygame.K_UP:
                print "A"
            if event.key == pygame.K_RIGHT:
                print "B"
            if event.key == pygame.K_LEFT:
                print "C"

如果没有提供确切的错误消息,您会得到

答案 1 :(得分:0)

您是否尝试过使用指定的文本明确查找按钮?

parse_str(str_replace(PHP_EOL, '&', $data), $result);

根据您的水豚版本,您还可以指定搜索是否不完全 find('button', text: '11 - teste')