headless

LibreOffice 转成pdf与html格式,实现在线预览

試著忘記壹切 提交于 2020-08-07 13:30:37
import java.io.File; import java.io.IOException; import java.io.InputStream; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; public class LibreOfficeUtil { private static final String LIBER_OFFICE_HOME = "C:/Program Files/LibreOffice/program/" ; private static final String FILE_DOWNLOAD_PATH = "d:/test/file/" ; private static final String FILE_PREVIEW_PATH = "d:/test/preview/" ; private static final String ENCODEING_UTF8 = "UTF-8" ; public static void main(String[] args) throws IOException { System.out.println(convert( "a.docx", "pdf" )); } /** * @param

python3+msedgedriver用新版msedge进行chrome-handless测试

半腔热情 提交于 2020-08-07 02:04:37
首先下载驱动 https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ 然后解压,把解压后的文件夹添加进环境变量path 然后安装两个包: pip install msedge-selenium-tools selenium 然后就可以了: from msedge.selenium_tools import Edge, EdgeOptions options = EdgeOptions() options.use_chromium = True options.binary_location = r " C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe " options.add_argument( " headless " ) options.add_argument( " disable-gpu " ) browser = Edge(options = options) browser.get( ' https://www.google.com ' ) browser.save_screenshot('google.png') print ( ' done ' ) browser.quit() 来源: oschina 链接:

k8s部署zk集群

最后都变了- 提交于 2020-08-05 19:23:59
一、简介 1.1、statefulset控制器简介 statefulset控制器是有状态应用副本集;在k8s集群statefulset用于管理以下副本集: 稳定且唯一的网络标识符 稳定且持久的存储 有序,平滑的部署和扩展 有序,平滑的删除和终止 有序的滚动更新 statefulset包含三个组件:headless service、StatefulSet,volumeClaimTemplate headless service:确保解析名称直达后端pod volumeClaimTemplate:卷申请模板,每创建一个pod时,自动申请一个pvc,从而请求绑定pv StatefulSet:控制器 二、部署 2.1、创建pv与pvc kubernetes上的存储卷类型 emptyDir:空目录,按需创建;删除pod后存储卷中的数据也被删除,一般用于临时目录或缓存 hostPath:主机路径,在node上找一个目录与pod中的容器建立联系 gitRepo:基于emptyDir实现的git仓库 clone到emptyDir存储卷 NFS:将现有NFS(网络文件系统)共享安装到Pod中 2.1.1、准备 master节点: kubectl create ns bigdata node节点: mkdir -pv /data/pv/zk{1..3} 2.1.2、定义pv与pvc资源文件

selenium tests fail against headless chrome

夙愿已清 提交于 2020-08-02 08:12:28
问题 I am trying to get my selenium test automation to run against headless chrome so that I can move it to TeamCity. I have not had any luck. When I run it, Chrome does appear to run headlessly (no browser pops up), but I get a NoSuchElementException . The automation works as expected when run non-headlessly. A snapshot taken just shows a white rectangle. I have researched this issue extensively, but I have not been able to find a solution that works for me. It appears that the issue was reported

selenium tests fail against headless chrome

本小妞迷上赌 提交于 2020-08-02 08:12:07
问题 I am trying to get my selenium test automation to run against headless chrome so that I can move it to TeamCity. I have not had any luck. When I run it, Chrome does appear to run headlessly (no browser pops up), but I get a NoSuchElementException . The automation works as expected when run non-headlessly. A snapshot taken just shows a white rectangle. I have researched this issue extensively, but I have not been able to find a solution that works for me. It appears that the issue was reported

[转载] java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment

倾然丶 夕夏残阳落幕 提交于 2020-07-28 08:01:39
### Activiti 生成流程图 测试环境在 Activiti 生成流程图的时候偶尔会出现错误: java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment 但是只要出现一次就一直引起后端报错。看起来应该和Activiti没有关系,而是和调用的图形功能有关。 ###解决 解决方案似乎很快就找到了,虚拟机启动添加参数: -Djava.awt.headless=true 或运行的程序执行: System.setProperty(“java.awt.headless”, “true”); ###原因 图形库调用似乎会使得程序试图调用 XWindows 运行在图形界面中,当对应的 dll 或者 so 文件找不到的时候就会出现这样的类定义找不到的错误。真正的解决方案似乎是需要安装 Xorg 相关的库,并将他们置于 classpath 中。headless 的设定是让程序不运行在图形界面下,而是运行在命令行模式下,这对一般的 web 程序应该是没影响的,但是对于有 UI 交互的程序就不适用了,还是需要解决依赖问题才行。 来源: oschina 链接: https://my.oschina.net/vxb/blog/4331005

puppeteer csdn 登录 [失败, 跨域cookie无法解决]

妖精的绣舞 提交于 2020-07-27 13:49:29
使用 puppeteer 登录csdn 暂时没能解决这个问题 滑块可以滑到右边 原因在于cookie const puppeteer = require('puppeteer'); const uid = '==='; const pwd = '==='; (async () => { const browser = await puppeteer.launch({ headless: true, //有浏览器界面启动\ // headless: false, //有浏览器界面启动\ // executablePath: '/path/to/Chrome' // slowMo: 100, //放慢浏览器执行速度,方便测试观察 // args: [ //启动 Chrome 的参数,详见上文中的介绍 // // '–no-sandbox', // '--disable-web-security', // "--allow-cross-origin-auth-prompt", // "--process-per-site" // // '--window-size=1280,960' // ], // ignoreDefaultArgs: ["--enable-automation"], // 貌似会清空数据...简直了, 而且必须关闭浏览器 // userDataDir: "C:

Setting sensors (location) in headless Chrome

不想你离开。 提交于 2020-06-15 18:36:04
问题 Is it possible to set custom location coordinates with Chrome Headless? I can't find it in the Devtools protocol API. Is there a workaround available? 回答1: I googled it and got many methods. I try one by one, almost all of them turn out outdated. Then I find out a solution, use chrome devtools protocol to achieve that. The small example code below, that it uses the most common tool selenium to execute chrome devtools protocol command. import time from selenium.webdriver import Chrome,

Setting sensors (location) in headless Chrome

岁酱吖の 提交于 2020-06-15 18:35:30
问题 Is it possible to set custom location coordinates with Chrome Headless? I can't find it in the Devtools protocol API. Is there a workaround available? 回答1: I googled it and got many methods. I try one by one, almost all of them turn out outdated. Then I find out a solution, use chrome devtools protocol to achieve that. The small example code below, that it uses the most common tool selenium to execute chrome devtools protocol command. import time from selenium.webdriver import Chrome,

Python爬虫_selenium + Firefox的使用

依然范特西╮ 提交于 2020-05-05 15:12:27
驱动下载: http://chromedriver.storage.googleapis.com/index.html https://github.com/mozilla/geckodriver/releases 一、selenium启动Firefox浏览器。 1 from selenium import webdriver 2 # from selenium.webdriver.firefox.firefox_profile import FirefoxProfile 3 4 5 user_agent = ' Mozilla/5.0 (Linux; Android 7.0; BND-AL10 Build/HONORBND-AL10; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.132 MQQBrowser/6.2 TBS/044304 Mobile Safari/537.36 MicroMessenger/6.7.3.1340(0x26070331) NetType/4G Language/zh_CN Process/tools ' 6 7 proxy = ' 127.0.0.1:5000 ' 8 proxy = proxy.split( ' : ' ) 9 10 11 #