首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Xlib:展区-- "RANDR“展示会:99”

Xlib:展区-- "RANDR“展示会:99”
EN

Stack Overflow用户
提问于 2014-02-19 05:08:23
回答 2查看 8K关注 0票数 8

我遇到了一个问题。每当我运行我的测试类时,它都会显示以下错误:

代码语言:javascript
复制
Testsuite: com.lo.test.selenium.AssignCampaignTestCase
Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 46.991 sec
------------- Standard Error -----------------
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
Xlib:  extension "RANDR" missing on display ":99".
*** LOG addons.manager: Application has been upgraded
*** LOG addons.xpi: startup
*** LOG addons.xpi: Ignoring file entry whose name is not a valid add-on ID: /tmp/anonymous4942696774897131989webdriver-profile/extensions/webdriver-staging
*** LOG addons.xpi: checkForChanges
*** LOG addons.xpi-utils: Opening database
*** LOG addons.xpi-utils: Creating database schema
*** LOG addons.xpi: New add-on fxdriver@googlecode.com installed in app-profile
*** LOG addons.xpi: New add-on {972ce4c6-7e08-4474-a285-3208198ce6fd} installed in app-global
*** LOG addons.xpi: Updating database with changes to installed add-ons
*** LOG addons.xpi-utils: Updating add-on states
*** LOG addons.xpi-utils: Writing add-ons list
*** LOG addons.manager: shutdown
*** LOG addons.xpi: shutdown
*** LOG addons.xpi-utils: shutdown
*** LOG addons.xpi-utils: Database closed
Xlib:  extension "RANDR" missing on display ":99".
*** LOG addons.xpi: startup
*** LOG addons.xpi: Ignoring file entry whose name is not a valid add-on ID: /tmp/anonymous4942696774897131989webdriver-profile/extensions/webdriver-staging
*** LOG addons.xpi: checkForChanges
*** LOG addons.xpi: No changes found

        at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:109)
        at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:245)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:109)

我的考试课:

代码语言:javascript
复制
package com.lo.test.selenium; 

import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import java.util.Properties;
import java.util.ResourceBundle;

import javax.mail.Flags;
import javax.mail.Folder;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.NoSuchProviderException;
import javax.mail.Session;
import javax.mail.Store; 
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.support.ui.WebDriverWait;

public class MyExampleTestCase {

    private static ResourceBundle rb = ResourceBundle.getBundle("global-messages");

    static WebDriver driver = new FirefoxDriver();  //Make it static in order to make one instance of this class(helps to avoid opening of 2 browsers at once)

    @Test
    public void campaignEmailTestCase() throws InterruptedException { 
        MyExampleTestCase emTesObj = new MyExampleTestCase ();  
        String fName = "test LO";
        Integer LeadId = 570903;
        String campaignName = "2Get"; 
        String SubjName = "Welcome"; //NOTE: No problem, Type without double quotes. It will work for you 

        emTesObj.doLogin(); 
        emTesObj.goToLeadsListPage();
        emTesObj.searchByFirstName(fName); //without this also,it will work but gives you the correct navigation on UI
        emTesObj.waitBeforePageLoads(LeadId.toString()); //pass the Id attribute which you aspect to see after the page is loaded
        emTesObj.assignCampaign(LeadId, campaignName);  
        emTesObj.readRecentEmail(SubjName);  
    }
}

更新:

我尝试了下面的代码,但是在执行这段代码和这段代码也显示了一些错误。之后,它仍然显示出相同的错误。

代码语言:javascript
复制
Xvfb :21 -screen 0 1024x768x24 -extension RANDR &

看起来这段代码没有正常运行。有人能帮我吗?

EN

回答 2

Stack Overflow用户

发布于 2014-08-29 08:46:41

关于我的最后一条评论,日志消息"RANDR" missing on display ":99"通常不是一个问题。运行fc-match时,检查是否安装了任何字体。否则,您的火狐将无法启动,因此WebDriver将无法连接。

代码语言:javascript
复制
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms.
票数 0
EN

Stack Overflow用户

发布于 2018-02-26 08:47:05

创建一个bash脚本文件并放置以下代码。在运行测试之前运行此文件。

代码语言:javascript
复制
#!/usr/bin/env bash
##script to install the necessary dependency for headless firefox browser
remove_Xvfb (){
kill -9 $(ps -ef | grep [X]vfb | awk '{print $2}')
}
remove_screenLock (){
Xvfb :3000 -screen 0 1024x768x16 &
file="/tmp/.X3000-lock"
if [ -f "$file" ]; then
    echo "Screen Exits..removing it and installing it again"
    sudo rm -rf "$file"
    export DISPLAY=:3000
else
    echo "Screen Does not Exists....Creating one"
    export DISPLAY=:3000
fi
}
yum install -y xdg-utils xorg-x11-server-Xvfb fontconfig freetype freetype-devel fontconfig-devel libstdc++ Xvfb firefox
sudo ln -s /usr/lib64/firefox/firefox /usr/bin/firefox
running=`ps ax | grep -v grep | grep Xvfb | wc -l`
if [ $running -gt 0 ]; then
    echo " Xvfb is running, removing it"
    remove_Xvfb
    remove_screenLock
else
    remove_screenLock
fi

这将为您的UI基础测试用例创建一个使用firefox浏览器的虚拟显示。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21871568

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档