小编Art*_*rty的帖子

无法使用Selenium2(Webdriver)与Java一起启动IE浏览器

我无法启动IE浏览器来运行用Java编写的selenium自动化测试.我正在使用Windows 7和IE 9.以下是我的代码:

请找到附件.在此输入图像描述

public class GoogleNews {
    private WebDriver driver;
    private String baseUrl;
    private StringBuffer verificationErrors = new StringBuffer();
    ArrayList al = new ArrayList();
    @Before
    public void setUp() throws Exception {
        //driver = new FirefoxDriver();
        driver =new InternetExplorerDriver();
        baseUrl = "https://news.google.co.in/";

    }

    @Test
    public void testApple() throws Exception {
        driver.get(baseUrl);
    }
}
Run Code Online (Sandbox Code Playgroud)

java internet-explorer selenium-webdriver

56
推荐指数
3
解决办法
13万
查看次数

程序类型已存在:org.intellij.lang.annotations.Flow

每当我尝试在Kotlin中运行程序时,我都会收到此错误.我的gradle文件是这样的:Project Level Gradle

buildscript {
    ext.kotlin_version = '1.2.30'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:3.2.0'
    }
}
allprojects {
    repositories {
        google()
        jcenter()
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)

和App Level Gradle

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'
ext.supportLibraryVersion = '27.1.1'
ext.playServices = '11.6.2'
android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.rossa.rossa"
        minSdkVersion 15
        targetSdkVersion 27
        versionCode 1
        versionName "1.0.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled …
Run Code Online (Sandbox Code Playgroud)

android intellij-idea kotlin android-studio kotlin-android-extensions

21
推荐指数
2
解决办法
7811
查看次数

Babel 不转换 fetch api 代码

fetch api 非常有用,但不幸的是它不适用于大多数浏览器,尤其是 Internet Explorer。我尝试使用 babel 将我的代码从 es6 转换为 es5,但它没有解决这个问题。转换成es5的时候还是包含fetch的。我怎样才能解决这个问题。这是es6代码:

var btnText = document.getElementById('btnText');
var btnJson = document.getElementById('btnJson');
btnText.addEventListener("click",fetchBtnText);
function fetchBtnText() {
  fetch("sample.txt")
    .then((response) => response.text())
.then((data) => console.log(data))
}
Run Code Online (Sandbox Code Playgroud)

这是到es5的转换

'use strict';
var btnText = document.getElementById('btnText');
var btnJson = document.getElementById('btnJson');
btnText.addEventListener("click", fetchBtnText);
function fetchBtnText() {
  fetch("sample.txt").then(function (response) {
    return response.text();
  }).then(function (data) {
    return console.log(data);
  });
}
Run Code Online (Sandbox Code Playgroud)

html javascript es6-promise fetch-api

7
推荐指数
1
解决办法
7359
查看次数

未捕获的ReferenceError:未定义'functionName'

所以我在.jsp文件中检查了我的脚本标签:

<script type="text/javascript" src="javascript/jquery-1.3.1.min.js"></script>

<script language="JavaScript" > "some content here ...." </script>
Run Code Online (Sandbox Code Playgroud)

在同一个.jsp文件中我有一个标签:

<body BGCOLOR="white" text="black" link="blue" vlink="red" onLoad="functionName();enableBackButton();">
Run Code Online (Sandbox Code Playgroud)

但是,在我的JavaScript文件中,我有:

$(document).ready(function(){
$('current').click(function(event){

    function functionName() { ....... }
Run Code Online (Sandbox Code Playgroud)

不知何故,我的Chrome控制台一直出现错误,说明:

未捕获的ReferenceError:未定义functionName

javascript jquery

5
推荐指数
1
解决办法
1万
查看次数

使用 Wiremock 测试 Feign 客户端

所以我花了一天的时间试图解决这个问题,这非常困难。所以问题是,当您有一个使用 Feign 的简单客户端时,如下所示:

@FeignClient(name = "identity-service")
public interface IdentityClient {

    @GetMapping(value = "/")
    String request();
}
Run Code Online (Sandbox Code Playgroud)

当然,您的应用程序注释@EnableFeignClients如下:

@EnableEurekaClient
@SpringBootApplication
@EnableFeignClients
public class LicenseServiceApplication {

    public static void main(String[] args) {
        SpringApplication.run(LicenseServiceApplication.class, args);
    }
}
Run Code Online (Sandbox Code Playgroud)

如果我对该假客户端进行如下测试:

@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment= SpringBootTest.WebEnvironment.NONE)
public class LicenseServiceTest {

    @ClassRule
    public static WireMockClassRule wiremock = new WireMockClassRule(
        WireMockSpring.options().dynamicPort());

    // A service that calls out over HTTP
    @Autowired
    private IdentityClient identityClient;

    // Using the WireMock APIs in the normal way:
    @Test
    public void contextLoads() throws Exception …
Run Code Online (Sandbox Code Playgroud)

spring wiremock spring-cloud netflix-eureka spring-cloud-feign

4
推荐指数
1
解决办法
8306
查看次数

是否有使用 mapstruct 的 spring pageable/sort 自动映射

我喜欢使用 mapstruct,但我找不到:是否有一个函数可以将 Pageable 中的 Sort 转换为映射的 dto pageable 到实体 pagable?

链接:

可分页:https ://docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/domain/Pageable.html

排序:https : //docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/domain/Sort.html

故事:

有一个请求:

@GetMapping("find")
public List<DTO> findAll(final Pageable pageable) {
    return mapper.map(repository.findAll(pagable));
}
Run Code Online (Sandbox Code Playgroud)

和存储库:

public interface Repository extends JpaRepository<Entity, Long> {
   Page<Entity> findAll(Pageable pageable);
}
Run Code Online (Sandbox Code Playgroud)

如果我不想公开实体列名称,那么我会映射该列。例如:

@Mapper
public interface DTOMapper {

    @Mappings({
       @Mapping(source = "make", target = "manufacturer"),
    })
    DTO toDto(Entity entity);
}
Run Code Online (Sandbox Code Playgroud)

现在 API/返回值有manufacturer. 的使用manufacturer用于排序请求代替(包括在可分页)make是可能的:sort=manufacturer;asc。

但一定不是sort=make;asc,或者可以JpaRepository处理它吗?

那么有没有一种简单的方法可以将可分页从请求转换为正确的可分页(使用正确的排序)?

谢谢你的答案。

java spring-boot mapstruct

3
推荐指数
1
解决办法
5590
查看次数