DevOps 应用集

分类: Uncategorized

Localhost环境下搭建nomad

Posted on 14 12 月, 2018 by admin

Nomad是一种部署cluster scheduler工具,有时我们需要在本地localhost搭建环境学习怎样使用,
如下步骤是安装在ubuntu18.04下

1) 下载nomad 二进制版本 下载Nomad,并把nomad程序加入到bin目录下

2) 然后我们需要一个启动server配置文件, 如下并注意里面的注释:
then need to add bin path to execute.

# Increase log verbosity
log_level = "DEBUG"

# Setup data dir
# to store status data
data_dir = "/tmp/server1"


advertise {
        #used for more agents
	rpc = "127.0.0.1:4647"
	serf = "127.0.0.1:4648"
}

# Enable the server
server {
    #server mode
    enabled = true

    # Self-elect, should be 3 or 5 for production
    bootstrap_expect = 1
}

#if you have not install vault, please comment all configs
vault {
        # unseal
	enabled = true
        #vault server address
	address = "http://127.0.0.1:8200"
	#token generated by vault to access api
	token = "2cc25b79-b39e-e821-3e22-6d3d4d7ae7fe"
}

可以保存文件名为server.hcl

3) 并且我们也需要一个带有client配置文件作为agent, 例子如下:

# Increase log verbosity
log_level = "DEBUG"

# Setup data dir
# store the agent status data
data_dir = "/tmp/client1"

# Give the agent a unique name. Defaults to hostname
name = "client1"

# Enable the client
client {
    #enable client
    enabled = true
    # report to nomad server
    servers = ["127.0.0.1:4647"]
}

保存并命名为nclient.hcl

4) 之后我们就可以启动 nomad server 和 agent
打开新的命令行窗口

#start nomad as server
nomad agent -config server.hcl

5) Start nomad client
打开新的命令行窗口

# Note -network-interface=lo means use internal interface 
nomad agent -config nclient.hcl -network-interface=lo

Then we can check http://localhost:4646 to check gui works…

附件 nomad hcl file 包括 (nserver.hcl, nclient.hcl)

Posted in UncategorizedLeave a Comment on Localhost环境下搭建nomad

从Selenium1迁移到Selenium3发生的错误及纠正

Posted on 11 12 月, 2018 by admin

由于框架迁移而发生老的系统需要运行在新的浏览器做自动化测试,并需要保持正常,面对新版浏览器,处理csv命令java脚本也需要做相应的调整……

如下一些错误发生自测试中,并得到纠正

1. 由于FFv63切换页面运行速度过快

当 WebDriverWait 无法处理等待时间时, 我们需要考虑另一个简单直接的方法等待页面的刷新, 但这种方法不是最好的,只会作为能否等待的操作.

try {
    Thread.sleep(seconds);
}
catch( Exception e) {
    e.printStackTrace();
}

把这段凑得放在页面刷新或者Post的之前或之后的动作,这样需要停几秒钟,一般这种情况经常发生在click 和 type 命令.

2. 元素不能点击,提示:Element is not clickable…
因为元素的位置不能合适的显示正常的位置,而click action由于被其他元素挡住,所以不可用,因为我们需要调整元素的位置
:

WebDriver driver=...;
WebElement element=...;
JavascriptExecutor executor = (JavascriptExecutor) driver;

int eleY = element.getLocation().y +/- offset; //down or up
int eleX = element.getLocation().x +/- offset; //right or left

executor.executeScript("window.scrollTo(" + eleX + "," + eleY + ")");
//get element focus and enable click, some cases can skip it
element.sendKeys("");

element.click();

移动到相应的位置并且点击
另一个原因是因为anchor的link像<a href…> 在FFv63 也不能被点击的情况
因此solution code 如下

JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("arguments[0].innerHTML=arguments[1]", element, "sometext"); //change to text, so can click
element.click();

替换anchor inner html text, 就可以clickable了.

 

3. 不能滑动view issue:Can not scroll to the view issue
一般发生在拥有长item的select标签,当点击select时it item在屏幕中看不到只能手动scroll to 出来,
但是目前方法不能支持这个操作,但有以下solution

JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("window.scrollBy(0,+/- offset)", ""); // +/-:means scroll down or up to the page
new Actions(driver).moveToElement(element).perform();  //use Actions to scroll to element
element.click();

If select position is not good, we need to adjust first using above position solution.
如果select位置不好,首先需要重新调整,方法如上
 

4.Checkbox 不能被checked issue
这里我们需要用到js:

js.executeScript("document.getElementById('" + element.getAttribute("id")+ "').setAttribute('checked','checked');");

这些解决方法code最好放置在catch块中,避免影响其他case的运行,
还有多数issues,我们仍需要debug或手动操作追踪页面element

Posted in UncategorizedLeave a Comment on 从Selenium1迁移到Selenium3发生的错误及纠正

近期文章

  • Oracle表中字段为timestamp值转化为date显示的sql语句
  • 解决idea环境代码保存后不能实时编译的问题
  • 自定义XStream fields序列化顺序
  • Oracle 修改blob为clob,clob为blob
  • Apple Script: 备份Mac Notes到PDFs

近期评论

    归档

    • 2021 年 2 月
    • 2020 年 8 月
    • 2020 年 7 月
    • 2020 年 1 月
    • 2019 年 11 月
    • 2019 年 5 月
    • 2019 年 3 月
    • 2019 年 2 月
    • 2018 年 12 月

    分类

    • Apple Script
    • docker
    • Git
    • gRPC
    • Hana
    • Idea
    • Java
    • Jenkins
    • Linux
    • Maven
    • Mockito
    • Oracle
    • Selenium
    • Sona
    • SpringBoot
    • Tomcat
    • Uncategorized
    • VirtualBox
    • VMWare
    • VPN
    • XML

    其他操作

    • 登录
    • 条目 feed
    • 评论 feed
    • WordPress.org

    bidvertiser

    Powered by DoHints.cn