When using selenium-webdriver, something attempts to bind to a port, listening for connections from the unspecified IPv6/IPv4 host (:: / 0.0.0.0). This triggers a firewall message.
I'd like to avoid this firewall message by forcing whatever this is to bind only to localhost, but I can't find any clues about what this server is or how to configure it.
Example code which replicates the issue:
const webdriver = require('selenium-webdriver');
const driver = new webdriver.Builder().forBrowser('chrome').build();
setTimeout(() => {
driver.quit();
}, 10000);
On macOS, this shows the prompt:
Do you want the application “node” to accept incoming network connections?
Obviously choosing "deny" still allows the tests to run (since everything is local anyway), and after selecting this option the OS remembers the choice until Node is updated, but I'd like to lock-down the test so that this isn't an issue.
What is causing this? How can I configure it?
You can use Selenium Standalone Server and bind it to a specific IP address. Additionally you can disable IPv6 addresses lookup.
Launch Selenium Standalone Server like:
java -Djava.net.preferIPv4Stack=true -jar selenium-server-standalone-x.xx.x.jar -host 10.20.30.40
Amend your webdriver initialization code to explicitly set the Selenium Server address like:
const driver = new webdriver.Builder().forBrowser('chrome').usingServer('http://10.20.30.40:4444/wd/hub').build();
replace this 10.20.30.40 with the IP address of your choice (the IP address or alias must exist on the system where you run the test)
References:
Selenium with JavaScript - The Standalone Selenium Server
Connecting Selenium Hubs to Cloud Server
Related
I am trying to make a connection from a server running Ubuntu to a Beckhoff PLC with TwinCAT 3. With Windows everything works fine but with the same server on Linux I can't get a connection.
The Linux server has a static IP and in the route manager in the PLC I can find the route and see the server. I have tried adding the route by the route manager in the PLC and with "add_route_to_plc" but both ways my connection is refused. I have already turned off all firewalls. Any of you guys any idea what goes wrong here? In the attachment I have added some picture to see my settings and code that I try to run.
Python error: "connection closed by remote"
Python code:
import pyads
SENDER_AMS = '192.168.1.180.1.1'
PLC_IP = '192.168.1.100'
PLC_USERNAME = 'Administrator'
PLC_PASSWORD = '1'
ROUTE_NAME = 'GID_TEST_ROUTE'
HOSTNAME = 'Grid-stabilizer'
pyads.open_port()
pyads.set_local_address(SENDER_AMS)
pyads.add_route_to_plc(SENDER_AMS, HOSTNAME, PLC_IP, PLC_USERNAME, PLC_PASSWORD, route_name=ROUTE_NAME)
pyads.close_port()
plc=pyads.Connection('192.168.1.100.1.1', pyads.PORT_TC3PLC1)
plc.open()
plc.read_state()
If you are running python on linux and the plc on windows try
plc=pyads.Connection('192.168.1.100.1.1', pyads.PORT_TC3PLC1, PLC_IP)
This will create a route on the linux system. In your code the ip is missing to create a proper route.
Check the port of your plc. It should be 851.
I have a Spark streaming application (Spark 2.4.4) running on AWS EMR 5.28.0. In the driver application on master node, besides setting up the spark streaming job, I am also running a http server (Akka-http 10.1.6) which can query the driver application for data, I bind to port 6161 like the following:
val bindingFuture: Future[ServerBinding] = Http().bindAndHandle(myapiroutes, "127.0.0.1", 6161)
try {
bindingFuture.map { serverBinding =>
log.info(s"AlertRestApi bound to ${serverBinding.localAddress}")
}
} catch {
case ex: Exception => {
log.error(s"Failed to bind to 127.0.0:6161")
system.terminate()
}
}
then I start spark streaming:
ssc.start()
When I test this on local spark, I am able to access http://localhost:6161/myapp/v1/data and get data from spark streaming, everything is good so far.
However, when I run this application in AWS EMR, I could not access port 6161. I ssh into the driver node and try to curl my url, it gives me error message:
[hadoop#ip-xxx-xx-xx-x ~]$ curl http://xxx.xx.xx.x:6161/myapp/v1/data
curl: (7) Failed to connect to xxx.xx.xx.x port 6161: Connection refused
when I look into the log in the driver node, I do see the port is bound (why the host shows 0:0:0:0:0:0:0:0? I don't know, that is the way in my dev testing, and it works, I see the same log and able to access the url):
20/04/13 16:53:26 INFO MyApp: MyRestApi bound to /0:0:0:0:0:0:0:0:6161
So my question is, what should I do so that I can access the api at port 6161 on the driver node? I realize Yarn resource manager may be involved but I know nothing about Yarn resource manager to point myself where to investigate.
Please help. Thanks
You are mentioning 127.0.0.1 as the host name or 0.0.0.0??
127.0.0.1 will work in your local system but not in AWS as it is loopback address. In such case you need to use 0.0.0.0 as the host name
Also make sure that ports are open and access is provided from your IP. To do that, go to Inbound rules for your instance and add 6161 under custom TCP rule if not done already.
Let me know if this makes any difference
Change phppgadmin connection from adodb to php7.2-pgsql
Tried running an SQL query on database from phppgadmin and got error "Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /usr/share/php/adodb/adodb-error.inc.php on line 114"
In my config.inc.php I don't see anything about defining a connection type
// Display name for the server on the login screen
$conf['servers'][0]['desc'] = 'PostgreSQL';
// Hostname or IP address for server. Use '' for UNIX domain socket.
// use 'localhost' for TCP/IP connection on this computer
$conf['servers'][0]['host'] = 'phppgadmin.com';
// Database port on server (5432 is the PostgreSQL default)
$conf['servers'][0]['port'] = 5432;
I would like to change the default connection from adodb to php7.2-pgsql
You need to run a newer version of phppgadmin with proper support for php7. I'd suggest just grabbing the code from git master at https://github.com/phppgadmin/phppgadmin
I am using Jmeter 3.2 and I need to do a telnet connection and parse the response.
Is it possible using Jmeter 3.2 or adding any plugin?
What I need to achieve is what I would do using this command line
telnet
open [IP] [PORT]
and understand if the connection is established or not.
Also I wonder what is the effective difference if I simply use a TCP Sampler.
Thanks
Given you have groovy tag here's how you can test the connectivity using Socket class, the example code would be something like:
def sock = new Socket()
sock.setSoTimeout(1000)
sock.connect(new InetSocketAddress("example.com",80))
if (sock.isConnected()) {
log.info('Connection established')
}
else {
log.info('Server is not listening')
}
Also be aware that you can invoke telnet command directly using String.execute() method like:
"telnet example.com 80".execute().text
And last but not the least, you can run an arbitrary command or program using JMeter's OS Process Sampler.
Hi All,
I want to create a JSP page where I will ask user to give the source host and port and also destination host and port.
Following combination of source and destination OS is possible
Unix->Unix/Windows/zOS Windows-> Unix/Windows/zOS zOS ->
Unix/Windows/zOS
With these inputs I want to connect to the source server and fire this command telnet $ip $port to the destination. If the telnet connectivity is successful it should return success and else error.
I want to create the logic non-interactive that it should not require any password to login the source for checking telnet connectivity.
Is there any such library or any mechanism available so that I could make this feasible?
Why not use Apache Commons Net?
TelnetClient telnet = new TelnetClient();
try {
telnet.connect("rainmaker.wunderground.com", 3000);
} catch(IOException e) {
// failed
} finally {
telnet.disconnect();
}