Press TAB and then ENTER key in Selenium WebDriver

后端 未结 6 1898
臣服心动
臣服心动 2020-12-16 10:26

Press TAB and then ENTER key in Selenium WebDriver

GenericKeywords.typein(class.variable, PageLength); pagelength is nothing but string.

After this code, I h

6条回答
  •  青春惊慌失措
    2020-12-16 11:04

    In javascript (node.js) this works for me:

    describe('UI', function() {
    
    describe('gets results from Bing', function() {
        this.timeout(10000);
    
        it('makes a search', function(done) {
            var driver = new webdriver.Builder().
            withCapabilities(webdriver.Capabilities.chrome()).
            build();
    
    
            driver.get('http://bing.com');
            var input = driver.findElement(webdriver.By.name('q'));
            input.sendKeys('something');
            input.sendKeys(webdriver.Key.ENTER);
    
            driver.wait(function() {
                driver.findElement(webdriver.By.className('sb_count')).
                    getText().
                    then(function(result) {
                      console.log('result: ', result);
                      done();
                });
            }, 8000);
    
    
        });
      });
    });
    

    For tab use webdriver.Key.TAB

提交回复
热议问题