我有一个简单的用户登录,如果登录失败,会显示通知(https://developer.mozilla.org/en-US/docs/Web/API/notification)或警报(如果通知被禁用)。
此外,我想在NodeJS中使用selenium测试此登录,但没有通知(仅警报)。所以我尝试使用chrome实验选项停用chrome中的通知功能。然而它确实显示了通知。也许这个功能不支持atm。
我在NodeJS中尝试了以下内容:
ERROR org.apache.spark.executor.Executor - Exception in task 0.0 in stage 135.0 (TID 114)
java.io.IOException: org.apache.spark.SparkException: Failed to get broadcast_1_piece0 of broadcast_1
at org.apache.spark.util.Utils$.tryOrIOException(Utils.scala:1222)
at org.apache.spark.broadcast.TorrentBroadcast.readBroadcastBlock(TorrentBroadcast.scala:165)
at org.apache.spark.broadcast.TorrentBroadcast._value$lzycompute(TorrentBroadcast.scala:64)
at org.apache.spark.broadcast.TorrentBroadcast._value(TorrentBroadcast.scala:64)
at org.apache.spark.broadcast.TorrentBroadcast.getValue(TorrentBroadcast.scala:88)
at org.apache.spark.broadcast.Broadcast.value(Broadcast.scala:70)
at com.uptake.readings.ingestion.StreamProcessors$$anonfun$processIncomingKafkaData$4.apply(StreamProcessors.scala:160)
at com.uptake.readings.ingestion.StreamProcessors$$anonfun$processIncomingKafkaData$4.apply(StreamProcessors.scala:158)
at scala.collection.Iterator$$anon$11.next(Iterator.scala:370)
at scala.collection.Iterator$$anon$11.next(Iterator.scala:370)
at scala.collection.Iterator$$anon$13.hasNext(Iterator.scala:414)
at org.apache.spark.storage.MemoryStore.unrollSafely(MemoryStore.scala:284)
at org.apache.spark.CacheManager.putInBlockManager(CacheManager.scala:171)
at org.apache.spark.CacheManager.getOrCompute(CacheManager.scala:78)
at org.apache.spark.rdd.RDD.iterator(RDD.scala:268)
at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:38)
at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:306)
at org.apache.spark.rdd.RDD.iterator(RDD.scala:270)
at org.apache.spark.scheduler.ShuffleMapTask.runTask(ShuffleMapTask.scala:73)
at org.apache.spark.scheduler.ShuffleMapTask.runTask(ShuffleMapTask.scala:41)
at org.apache.spark.scheduler.Task.run(Task.scala:89)
at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:214)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.spark.SparkException: Failed to get broadcast_1_piece0 of broadcast_1
at org.apache.spark.broadcast.TorrentBroadcast$$anonfun$org$apache$spark$broadcast$TorrentBroadcast$$readBlocks$1$$anonfun$2.apply(TorrentBroadcast.scala:138)
at org.apache.spark.broadcast.TorrentBroadcast$$anonfun$org$apache$spark$broadcast$TorrentBroadcast$$readBlocks$1$$anonfun$2.apply(TorrentBroadcast.scala:138)
at scala.Option.getOrElse(Option.scala:121)
at org.apache.spark.broadcast.TorrentBroadcast$$anonfun$org$apache$spark$broadcast$TorrentBroadcast$$readBlocks$1.apply$mcVI$sp(TorrentBroadcast.scala:137)
at org.apache.spark.broadcast.TorrentBroadcast$$anonfun$org$apache$spark$broadcast$TorrentBroadcast$$readBlocks$1.apply(TorrentBroadcast.scala:120)
at org.apache.spark.broadcast.TorrentBroadcast$$anonfun$org$apache$spark$broadcast$TorrentBroadcast$$readBlocks$1.apply(TorrentBroadcast.scala:120)
at scala.collection.immutable.List.foreach(List.scala:381)
at org.apache.spark.broadcast.TorrentBroadcast.org$apache$spark$broadcast$TorrentBroadcast$$readBlocks(TorrentBroadcast.scala:120)
at org.apache.spark.broadcast.TorrentBroadcast$$anonfun$readBroadcastBlock$1.apply(TorrentBroadcast.scala:175)
at org.apache.spark.util.Utils$.tryOrIOException(Utils.scala:1219)
... 24 more
以下代码适用于Java。
var options = new chrome.Options();
options.addArguments("profile.default_content_setting_values.notifications", "2");
var driver = new webdriver.Builder().withCapabilities(options.toCapabilities()).build();
答案 0 :(得分:1)
我必须设置userPreferences。
SELECT * FROM mytable WHERE uniqueEditableColumn like '%foobar%' ORDER BY uniqueEditableColumn ASC
SELECT * FROM mytable WHERE uniqueEditableColumn = 'foobar' ORDER BY uniqueEditableColumn ASC
SELECT * FROM mytable ORDER BY uniqueEditableColumn ASC
SELECT * FROM mytable ORDER BY uniqueEditableColumn ASC, creationDateTime DESC
答案 1 :(得分:0)
希望下面的代码工作。 这仅适用于Chrome
ChromeOptions opt = new ChromeOptions();
opt.AddArguments("--disable-notifications");
opt.AddArguments("--disable-popup-blocking");
driver = new ChromeDriver(@"C:\Users\ChromeDriverPath", opt);
答案 2 :(得分:0)
我从许多客户端看到此问题,尤其是当用户使用WebdriverIO nodeJS绑定时。以下代码片段用于JS和Java工作以启用位置设置:
对于JS:
var options = new chrome.Options();
options.setUserPreferences({'profile': {'managed_default_content_settings': {'geolocation': 1}}});
var driver = new webdriver.Builder().forBrowser('chrome').withCapabilities(options.toCapabilities()).build();
对于Java:
// Declare variables
ChromeOptions options = new ChromeOptions();
Map<String, Object> prefs = new HashMap<String, Object>();
Map<String, Object> profile = new HashMap<String, Object>();
Map<String, Object> contentSettings = new HashMap<String, Object>();
// Specify the ChromeOption we need to set
contentSettings.put(“geolocation”, 1);
profile.put(“managed_default_content_settings”, contentSettings);
prefs.put(“profile”, profile);
options.setExperimentalOption(“prefs”, prefs);
// Declare the capability for ChromeOptions
caps.setCapability(ChromeOptions.CAPABILITY, options);
答案 3 :(得分:0)
现在没有toCapabilities
方法。只需传递选项
const options = new chrome.Options();
options.setUserPreferences({'profile': {'managed_default_content_settings': {'geolocation': 2 }}});
this.driver = new Builder().forBrowser('chrome').withCapabilities(options).build();