51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 1754|回复: 3
打印 上一主题 下一主题

自动化第一步就卡住了 有没有大佬帮忙看看这咋回事啊

[复制链接]
  • TA的每日心情
    慵懒
    2019-9-17 09:37
  • 签到天数: 7 天

    连续签到: 1 天

    [LV.3]测试连长

    跳转到指定楼层
    1#
    发表于 2019-5-13 15:30:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
    本帖最后由 jiyihe 于 2019-5-13 15:39 编辑

    只能弹出浏览器 但是没有跳转

    这是源码




    import java.util.concurrent.TimeUnit;

    import org.openqa.selenium.By;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.WebElement;
    import org.openqa.selenium.firefox.FirefoxDriver;

    public class LuanchFirefox {

            public static void main(String[] args) {
                   
                    //System.setProperty("webdriver.firefox.marionette", ".\\Tools\\geckodriver.exe");
                    System.setProperty("webdriver.firefox.bin","E:\\Mozilla Firefox\\firefox.exe");
                    System.setProperty("webdriver.gecko.driver", ".\\tool\\geckodriver.exe");
                    //初始化一个火狐浏览器实例,实例名称叫driver
                                    WebDriver driver = new FirefoxDriver();
                                    //最大化窗口
                                    driver.manage().window().maximize();
                                    //设置隐性等待时间
                                    driver.manage().timeouts().implicitlyWait(8, TimeUnit.SECONDS);
                                   
                                    // get()打开一个站点
                                    driver.get("https://www.baidu.com");
                                    //getTitle()获取当前页面title的值
                                    System.out.println("当前打开页面的标题是: "+ driver.getTitle());
                                   
                                    //关闭并退出浏览器
                                    driver.quit();
                                   
            }
    }



    下面运行报错
    1557733073530        geckodriver        INFO        Listening on 127.0.0.1:47825
    1557733073990        geckodriver::marionette        INFO        Starting browser \\?\E:\Mozilla Firefox\firefox.exe with args ["-marionette"]
    1557733075678        addons.webextension.screenshots@mozilla.org        WARN        Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: mozillaAddons
    1557733075678        addons.webextension.screenshots@mozilla.org        WARN        Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: resource://pdf.js/
    1557733075679        addons.webextension.screenshots@mozilla.org        WARN        Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: about:reader*
    1557733075819        Marionette        TRACE        Received observer notification profile-after-change
    1557733076353        Marionette        TRACE        Received observer notification toplevel-window-ready
    1557733076383        Marionette        TRACE        Received observer notification command-line-startup
    1557733076383        Marionette        TRACE        Received observer notification nsPref:changed
    1557733076383        Marionette        DEBUG        Init aborted (running=false, enabled=true, finalUIStartup=false)
    1557733077438        Marionette        TRACE        Received observer notification toplevel-window-ready
    1557733079717        Marionette        TRACE        Received observer notification sessionstore-windows-restored
    1557733079717        Marionette        TRACE        GFX sanity window detected, waiting until it has been closed...
    1557733080543        Marionette        TRACE        Received observer notification domwindowclosed
    1557733080543        Marionette        TRACE        Waiting until startup recorder finished recording startup scripts...
    1557733080552        Marionette        TRACE        All scripts recorded.
    1557733080552        Marionette        DEBUG        Setting recommended pref app.normandy.api_url to
    1557733080553        Marionette        DEBUG        Setting recommended pref app.update.disabledForTesting to true
    1557733080553        Marionette        DEBUG        Setting recommended pref browser.contentblocking.introCount to 99
    1557733080554        Marionette        DEBUG        Setting recommended pref browser.safebrowsing.passwords.enabled to false
    1557733080554        Marionette        DEBUG        Setting recommended pref browser.urlbar.suggest.searches to false
    1557733080556        Marionette        DEBUG        Setting recommended pref datareporting.policy.dataSubmissionPolicyAccepted to false
    1557733080556        Marionette        DEBUG        Setting recommended pref dom.disable_beforeunload to true
    1557733080556        Marionette        DEBUG        Setting recommended pref dom.file.createInChild to true
    1557733080557        Marionette        DEBUG        Setting recommended pref network.http.phishy-userpass-length to 255
    1557733080557        Marionette        DEBUG        Setting recommended pref toolkit.cosmeticAnimations.enabled to false
    1557733080639        Marionette        INFO        Listening on port 11981
    1557733080639        Marionette        DEBUG        Remote service is active
    1557733081521        Marionette        DEBUG        Accepted connection 0 from 127.0.0.1:12024
    1557733081523        Marionette        DEBUG        0 -> [0,1,"newSession",{"capabilities":{"desiredCapabilities":{}}}]
    1557733081524        Marionette        DEBUG        0 <- [1,1,{"error":"unknown command","message":"newSession","stacktrace":"WebDriverError@chrome://marionette/content/error.js:179: ... et@chrome://marionette/content/server.js:235:8\n_onJSONObjectReady/<@chrome://marionette/content/transport.js:493:9\n"},null]
    五月 13, 2019 3:38:01 下午 org.openqa.selenium.remote.ErrorCodes toStatus
    信息: HTTP Status: '404' -> incorrect JSON status mapping for 'unknown error' (500 expected)
    Exception in thread "main" org.openqa.selenium.WebDriverException: newSession
    Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
    System info: host: 'JIYIHE-PC', ip: '192.168.1.118', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_151'
    Driver info: driver.version: FirefoxDriver
    remote stacktrace: stack backtrace:
       0:           0x48916f - <no info>
       1:           0x489f59 - <no info>
       2:           0x439ced - <no info>
       3:           0x4473ea - <no info>
       4:           0x445128 - <no info>
       5:           0x41dbb1 - <no info>
       6:           0x407997 - <no info>
       7:           0x6bbb39 - <no info>
       8:           0x415b39 - <no info>
       9:           0x6b6043 - <no info>
      10:         0x76ed59cd - BaseThreadInitThunk
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
            at java.lang.reflect.Constructor.newInstance(Unknown Source)
            at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$new$0(W3CHandshakeResponse.java:57)
            at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$getResponseFunction$2(W3CHandshakeResponse.java:104)
            at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$22(ProtocolHandshake.java:365)
            at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
            at java.util.Spliterators$ArraySpliterator.tryAdvance(Unknown Source)
            at java.util.stream.ReferencePipeline.forEachWithCancel(Unknown Source)
            at java.util.stream.AbstractPipeline.copyIntoWithCancel(Unknown Source)
            at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
            at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
            at java.util.stream.FindOps$FindOp.evaluateSequential(Unknown Source)
            at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
            at java.util.stream.ReferencePipeline.findFirst(Unknown Source)
            at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:368)
            at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:159)
            at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
            at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
            at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)
            at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:250)
            at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236)
            at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:137)
            at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:191)
            at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:108)
            at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:104)
            at LuanchFirefox.main(LuanchFirefox.java:19)

    分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    收藏收藏
    回复

    使用道具 举报

  • TA的每日心情
    无聊
    2015-1-20 14:07
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]测试小兵

    2#
    发表于 2019-5-13 16:55:46 | 只看该作者
    看一下FirefoxDriver 和Firefox浏览器版本不匹配
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    慵懒
    2019-9-17 09:37
  • 签到天数: 7 天

    连续签到: 1 天

    [LV.3]测试连长

    3#
     楼主| 发表于 2019-5-14 08:34:24 | 只看该作者
    xtloveplr520 发表于 2019-5-13 16:55
    看一下FirefoxDriver 和Firefox浏览器版本不匹配

    已解决 谢谢大佬
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    2024-10-4 10:34
  • 签到天数: 1208 天

    连续签到: 1 天

    [LV.10]测试总司令

    4#
    发表于 2019-5-20 08:40:05 | 只看该作者
    xtloveplr520 发表于 2019-5-13 16:55
    看一下FirefoxDriver 和Firefox浏览器版本不匹配

    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-11-22 22:21 , Processed in 0.068187 second(s), 23 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表