无法使用selenium webdriver在Compose E-mail页面上的To(Email id)字段中发送密钥

“ To ”Buttom 无法从selenium webdriver 获取密钥 。 在输出中,它显示无法定位元素。 “To”在iframe中,我使用了I帧但是它也没用。 import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class mail { public static void main(String[] args) throws InterruptedException { System.setProperty(“webdriver.gecko.driver”, “D:\mozilla driver\geckodriver.exe”); WebDriver driver=new FirefoxDriver(); driver.get(“https://www.mail.com/int/”); driver.findElement(By.xpath(“.//*[@id=’login-button’]”)).click(); driver.findElement(By.xpath(“.//*[@id=’login-email’]”)).sendKeys(“rahulrahulxyz@mail.com”); driver.findElement(By.xpath(“.//*[@id=’login-password’]”)).sendKeys(“incredible”); driver.findElement(By.xpath(“.//*[@id=’login-form’]/button”)).click(); driver.switchTo().frame(“thirdPartyFrame_home”); driver.findElement(By.linkText(“Compose E-mail”)).click(); Thread.sleep(5000); driver.switchTo().frame(“thirdPartyFrame_mail”); // **here is error** driver.findElement(By.xpath(“.//*[@id=’idbd’]/div[2]/div[1]/div[1]/div[2]/div/div/ul/li/input”)).sendKeys(“abcde@mail.com”); } }

Atomic Integer incrementAndGet()线程安全吗?

primefaces整数incrementAndGet()方法线程安全吗? 我没有看到在其中使用synchronized关键字。 我使用以下代码生成唯一ID: public enum UniqueIdGenerator { INSTANCE; private AtomicLong instance = new AtomicLong(System.currentTimeMillis()); public long incrementAndGet() { return instance.incrementAndGet(); } } 如果调用该方法生成唯一ID的多个线程会导致任何问题,我会徘徊吗? UniqueIdGenerator.INSTANCE.incrementAndGet() 谢谢!

jackson解串器为通用类型

我需要为具有generics的类编写自定义反序列化器。 我找不到办法做到这一点,但我无法想象我是唯一有这个问题的人。 据我所知,有两种方法可以实现它,但它们都不是可实现的: 在反序列化器的构造函数中为反序列化器提供Class参数不起作用,因为在注册反序列化器时,Type.class与反序列化器实例之间的关系将丢失。 例如: public class Foo {} public class FooDeserializer { public FooDeserializer(Class type) { … } … } // Boilerplate code… module.addDeserializer(Foo.class, new FooDeserializer(Bar1.class)); module.addDeserializer(Foo.class, new FooDeserializer(Bar2.class)); 这不起作用,当ObjectMapper实例获取Foo的实例时,没有可用的generics参数的类型信息(类型擦除),因此它只选择最后注册的反序列化器。 在类中保留generics类型的引用没有帮助,因为类的实例化版本无法传递给反序列化器(接口是readValue(String,Class))。 例如: String json = “…”; ObjectMapper mapper = …; Foo foo = new Foo(Bar1.class); foo = mapper.readValue(json, Foo.class); // Can’t pass empty foo […]

AspectJ – 使用预编译方面编译Java源代码

假设我有几个方面,我已经编译过了,现在我只想编译单个源文件,但不需要重新编译方面,因为它需要花费很多时间。 有没有办法这样做? 例如,我有以下内容: Trace.aj Log.aj Test.java 所有这些都是在我的“build-all”中编译的,现在我已经改变了Test.java并希望使用(已编译的)方面重新编译它。

在jFreeChart中一次显示所有XYSeries以提高速度

假设我们需要在单个XYSeriesCollection显示多个XYSeriesCollection 。 我的问题是每次添加XYSeries , JFreeChart都想更新图表,这会减慢显示多个XYSeries的过程。 我想要的是这样的: // Do not update the chart XYSeriesCollection.add(XYSeries1) XYSeriesCollection.add(XYSeries2) … XYSeriesCollection.add(XYSeries10) // Update the chart 我怎样才能做到这一点?

Java对象用jackson将列表扩展到Json

我想使用Jackson将扩展列表的对象转换为Json。 例: public class TryToSerialize extends ArrayList { private int number; private String word; public TryToSerialize(){ number = 0; word = “”; } @JsonProperty public int getNumber() { return number; } public void setNumber(int number) { this.number = number; } @JsonProperty public String getWord() { return word; } public void setWord(String word) { this.word = […]

在MySQL中严格自动递增值

我必须使用严格的顺序ID为表(行)中的每个元素创建一个MySQL InnoDB表。 ID中不能有任何间隙 – 每个元素必须具有不同的ID,并且必须按顺序分配。 并发用户在此表上创建数据。 我遇到了MySQL“自动增量”行为,如果事务失败,则不使用PK号,留下间隙。 我已经阅读了在线复杂的解决方案,这些解决方案并没有说服我和其他一些没有真正解决我的问题( 在MySQL / InnoDB中模拟自动增量, 在同步的mysql服务器上设置手动增量值 ) 我想最大限度地提高并发性。 我不能让用户在桌面上写字并等待很长时间。 我可能需要对表进行分片…但仍然保持ID计数。 表中元素的顺序并不重要,但ID必须是顺序的(即,如果在另一个元素之前创建元素不需要具有较低的ID,则不允许在ID之间存在间隙)。 我能想到的唯一解决方案是使用额外的COUNTER表来保持计数。 然后用空的“ID”(不是PK)在表中创建元素,然后锁定COUNTER表,获取数字,将其写在元素上,增加数字,解锁表。 我认为这样可以正常工作,但有一个明显的瓶颈:在锁定期间,没有人能够写任何ID。 此外,如果持有表的节点不可用,则是单点故障。 我可以创建一个“主人”吗? 复制但我不确定这种方式我是否冒冒险使用过时的ID计数器(我从未使用过复制)。 谢谢。

属性文件未使用Apache Commons Configuration反映修改的更改

我正在尝试探索Apache commons配置以动态加载属性文件并在文件中进行修改并保存。 我为此写了一个演示代码。 代码片段 package ABC; import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.PropertiesConfiguration; import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy; public class Prop { public static void main(String[] args) { try { URL propertiesURL = Prop.class.getResource(“/d1.properties”); if (propertiesURL == null) { System.out.println(“null”); } String absolutePath=propertiesURL.getPath(); PropertiesConfiguration pc = new PropertiesConfiguration(absolutePath); pc.setReloadingStrategy(new FileChangedReloadingStrategy()); String s=(String)pc.getProperty(“key_account_sales”); System.out.println(“s is ” + s); pc.setAutoSave(true); pc.setProperty(“key_account_sales”, “Dummy”); pc.save(); […]

Mesos框架

我想通过使用java和定义依赖关系在集群上分发Docker容器,这样当一个容器完成时,我可以在我的java代码中解析生成的输出。 有许多mesos框架可以实现这一点,我不确定采用哪一个:Marathon,Singularity,Chronos,Aurora。 到目前为止我学到了什么: Marathon有一个非常好的java客户端api但是用于长期任务(不知道这是否是一个问题,因为我的任务不会运行那么久)我不认为我可以定义那种依赖。 如果我使用马拉松,我将不得不轮询该应用程序的状态。 Chronos没有java api(至少我找不到)。 所以我可以选择Aurora和Singularity。 任何人都可以帮我推荐其中一个用于我的用例。

如何检测客户端机器是否已经安装了JRE版本?

在一个应用程序中,我们提供客户端选择使用JRE下载我们的应用程序的能力。 如果可以检测客户端系统是否已经配置了JRE,则可以为此function提供更加用户友好的操作。