Selenium is a popular open-source tool for automating web browsers. When using this tag, also include other tags for the specific components you are using, e.g. selenium-webdriver for the language bindings, selenium-ide, selenium-grid, etc.
I am currently new to robot framework.I am currently using latest window version of chrome and chromedriver which is 80 but when i try to run the test it gives the message "SessionNotCreatedException:..
I need to select an element from a drop-down menu.
For example:
<select id="fruits01" class="select" name="fruits">
<option value="0">Choose your fruits:</option>
<option v..
I am using Selenium in Java to test the checking of a checkbox in a webapp. Here's the code:
private boolean isChecked;
private WebElement e;
I declare e and assign it to the area where the checkbox ..
I have a grid which displays some records. When I click on a record and inspect that element it is shown that it is hidden but it is visible in the grid.
My HTML is:
<a href="http://192.168.1.6/..
Is there a way to maximize the chrome browser window using python selenium WebDriver?
Note: I am using Chrome Driver 23.0
Any solution on this would be greatly appreciated!..
I need to click the 'Ok' button inside an alert window with a Selenium command. I've tried assertAlert or verifyAlert but they don't do what I want.
It's possible the click the 'Ok' button? If so, ca..
I have written the following code in Selenium 1 (a.k.a Selenium RC) for page scrolling using java:
selenium.getEval("scrollBy(0, 250)");
What is the equivalent code in Selenium 2 (WebDriver)?..
I have a html href link
<a href="/docs/configuration">App Configuration</a>
using Selenium I need to click the link. Currently, I am using below code -
Driver.findElement(By.xpa..
I am trying to set Chrome as my browser for testing with Web-Driver and set the chromedriver.exe file properly but I am still getting the following error:
org.openqa.selenium.WebDriverException:
The..
I want to do mouseover function over a drop down menu. When we hover over the menu, it will show the new options.
I tried to click the new options using the xpath. But cannot click the menus directly...
I am running this code with python, selenium, and firefox but still get 'head' version of firefox:
binary = FirefoxBinary('C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe', log_file=sys.stdout)..
I have a long string to test and sendKeys() takes too long. When I tried to set the value of the text the program crashes. I know the Selenium sendKeys() is the best way to test the actual user input,..
I want to get the selected label or value of a drop down using Selenium WebDriver and then print it on the console.
I am able to select any value from the drop down, but I am not able to retrieve the..
I have box where I run tests. It seems like Jenkins would ssh in and execute commands described in the specific job that's running.
Here I am trying to run my Selenium Webdriver tests, but it tells ..
I'm writing a Selenium testcase. And here's the xpath expression I use to match all 'Modify' buttons within a data table.
//img[@title='Modify']
My question is, how can I visit the matched node set..
Is there any kind of API that can allow me to manipulate a file download dialog in Firefox?
(I want to access the one that appears when user does something, not initiate one myself).
What I want to d..
I have element in my code that looks like this:
<input id="invoice_supplier_id" name="invoice[supplier_id]" type="hidden" value="">
I want to set its value, so I created a web element with it..
As part of my Selenium test for a login function, I would like to click a button by identifying its coordinates and instructing Selenium to click at those coordinates. This would be done without ident..
I'm searching text "Cheese!" on google homepage and unsure how can I can click on the searched links after pressing the search button. For example I wanted to click the third link from top on search p..
In the HTML of a webapp there is the following code
<input type="text" name="prettyTime" id="prettyTime" class="ui-state-disabled prettyTime" readonly="readonly">
What is actually shown on t..
I've been using Selenium for a number of months, which we're using to automate some of our internal testing processes. The scripts have been passing fine. I've recently upgraded to C# 2.40.0 webdriver..
Is there a way to (easily) generate a HTML report that contains the tests results ? I am currently using JUnit in addition to Selenium for testing web apps UI.
PS: Given the project structure I am no..
Can anyone let me how can I make selenium wait until the time the page loads completely? I want something generic, I know I can configure WebDriverWait and call something like 'find' to make it wait b..
I am trying to login on facebook.com with selenium-webdriver.
var webdriver = require('selenium-webdriver'),
By = require('selenium-webdriver').By,
until = require('selenium-webdriver').until..
In Selenium Grid I am trying to execute a simple program and I'm getting Cannot find firefox binary in PATH though I have added the binary path in my code.
My code and the error are given below. Kindl..
I am looking for something like:
getElementByXpath(//html[1]/body[1]/div[1]).innerHTML
I need to get the innerHTML of elements using JS (to use that in Selenium WebDriver/Java, since WebDriver can'..
I downloaded the driver and I gave the exact path in my code but when I ran the code it shows me error
my code with java is as below:
System.out.println("Internet Explorer is selected");
System.setP..
<div id="a">This is some
<div id="b">text</div>
</div>
Getting "This is some" is non-trivial. For instance, this returns "This is some text":
driver.find_element_by_id('..
Currently I'm trying to capture a screenshot using the Selenium WebDriver. But I can only obtain the whole page screen shot. However, what I wanted is just to capture a part of the page or perhaps jus..
I'm new to both C# and Selenium WebDriver.
I know how to select/click on an option in a drop-down list, but I've a problem before that. Since the drop-down list is dynamically generated, I have to g..
Is there a way how to test if an element is present? Any findElement method would end in an exception, but that is not what I want, because it can be that an element is not present and that is okay, t..
I am using WebDriver and I have downloaded the InternetExplorerDriver and was wondering what I do with it after it is downloaded?
This says to put the driver in my path. Not really certain what exact..
I'm trying to handle authentication popup using the code below:
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("network.http.phishy-userpass-length", 255);
profile.setPreference..
I'm trying to make Selenium wait for an element that is dynamically added to the DOM after page load. Tried this:
fluentWait.until(ExpectedConditions.presenceOfElement(By.id("elementId"));
In case ..
I have just recently done an export of my selenium IDE code to selenium web driver. I have found that a lot of the commands that worked in IDE either fail to work or selenium web driver claims to not ..
When I enter text into the text field it gets removed.
Here is the code:
String barcode="0000000047166";
WebElement element_enter = _driver.findElement(By.xpath("//*[@id='div-barcode']"));
element..
How can I get selenium to wait for something like a calendar widget to load? Right now I am just doing a Thread.sleep(2500) after exporting the testcase to a junit program...
I need to click on the below href element,which is present among similar href elements.
<a id="oldcontent" href="listDetails.do?camp=1865"><u>Re-Call</u></a>
Can anyone prov..
I'm on EC2 instance. So there is no GUI.
$pip install selenium
$sudo apt-get install firefox xvfb
Then I do this:
$Xvfb :1 -screen 0 1024x768x24 2>&1 >/dev/null &
$DISPLAY=:1 java -..
Usually I download the drivers for Selenium from https://code.google.com/p/selenium/downloads/list
but I couldn't find the IEDriver Server at this location now. Can any one please share the latest do..
I'm using Selenium WebDriver, how can I check if some text exist or not in the page? Maybe someone recommend me useful resources where I can read about it. Thanks..
I have situation, when click on button opens the new browser window with search results.
Is there any way to connect and focus to new opened browser window?
And work with it, then return back to or..
Is there any way in either Selenium 1.x or 2.x to scroll the browser window so that a particular element identified by an XPath is in view of the browser? There is a focus method in Selenium, but it d..
Can anyone tell me how I can identify and switch to the iframe which has only a title?
<iframe frameborder="0" style="border: 0px none; width: 100%; height: 356px; min-width: 0px; min-height: 0px;..
I used explicit waits and I have the warning:
org.openqa.selenium.WebDriverException:
Element is not clickable at point (36, 72). Other element would receive
the click: ...
Command duratio..
I see this only in Chrome.
The full error message reads:
"org.openqa.selenium.WebDriverException: Element is not clickable at point (411, 675). Other element would receive the click: ..."
The e..
In the below code i cannot send password keys in the password field, i tried clicking the field, clearing the field and sending the keys. But now working in any of the method. But its working if i deb..
If I want to select an option of a dropdown box, there are several ways to do that. I always used:
driver.findElement(By.id("selection")).sendKeys("Germany");
But that didn't work every time. Som..
I am working with the Selenium WebDriver 2.25.0 on multilingual web application & mainly test the page content (For different languages like Arabic, English, Russian & so on).
For my applicat..
I'm using the Python bindings to run Selenium WebDriver:
from selenium import webdriver
wd = webdriver.Firefox()
I know I can grab a webelement like so:
elem = wd.find_element_by_css_selector('#my-id..
There are Implicit and Explicit wait in Selenium WebDriver. What's the difference between them?
Kindly share the knowledge about Selenium WebDriver. Please show the real time example with Implicit &a..
I'm trying to access elements that are present under <form> <iFrame> <form> elements </form> </iFrame> </form>.
Could you help me on accessing these 'elements', wh..
I am using Selenium 2.
But after running following code, i could not able to type in textbox.
package Actor;
import org.openqa.*;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDr..
consider following HTML:
<div id='a'>
<div>
<a class='click'>abc</a>
</div>
</div>
I want to click abc, but the wrapper div could change, so
driver.get_..
I have written tests with Selenium2/WebDriver and want to test if HTTP Request returns an HTTP 403 Forbidden.
Is it possible to get the HTTP response status code with Selenium WebDriver?..
With "HTML" Selenium tests (created with Selenium IDE or manually), you can use some very handy commands like WaitForElementPresent or WaitForVisible.
<tr>
<td>waitForElementPresent&l..
I am trying to run Selenium tests on Debian 7 but without success.
The error is:
unknown error: Chrome failed to start: exited abnormally (Driver info: chromedriver=2.9.248316,platform=Linux 3.2.0..
With WebDriver from Selenium 2.0a2 I am having trouble checking if an element is visible.
WebDriver.findElement returns a WebElement, which unfortunately doesn't offer an isVisible method. I can go a..
I'm working on a Java Selenium-WebDriver. I added
driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);
and
WebElement textbox = driver.findElement(By.id("textbox"));
because my App..
I use XPather Browser to check my XPATH expressions on an HTML page.
My end goal is to use these expressions in Selenium for the testing of my user interfaces.
I got an HTML file with a content simi..
I'm trying to have xpath find a div and verify that the div has a specific string of text inside.
Here's the HTML:
<div class="Caption">
Model saved
</div>
and
<div id="alertLabe..
How do I set up Selenium to work with Python? I just want to write/export scripts in Python, and then run them. Are there any resources for that? I tried googling, but the stuff I found was either ref..
I want to find the element of this link "us states" in <h5>. I am trying this in craigslist. Any help will be highly appreciated
Here is the url: http://auburn.craigslist.org/
<html cla..
Actually I'm a bit confused. Although I read several resources about this.
For having a test of Selenium 3 using ChromeBrowser we need an extra app called ChromeDriver.
I found this text from GitHub..
I'm trying to use xPath to find an element containing a piece of text, but I can't get it to work....
WebElement searchItemByText = driver.findElement(By.xpath("//*[@id='popover-search']/div/div/ul/l..
I'm using Selenium WebDriver for Python.
I want instantiate the browser with a specific width and height. So far the closest I can get is:
driver = webdriver.Firefox()
driver.set_window_size(1080,800..
We are considering upgrading our production server from Ubuntu-desktop 10.04 to Ubuntu-server 12.04.
We have various services running on our current desktop OS such as Selenium Web Driver. My questi..
How can I get the HTML source in a variable using the Selenium module with Python?
I wanted to do something like this:
from selenium import webdriver
browser = webdriver.Firefox()
browser.get("http..
While running selenium script, I am getting the following error message in Eclipse console:
Class has been compiled by a more recent version of the Java Environment (class file version 53.0), this..
I am quite new to python selenium and I am trying to click on a button which has the following html structure:
<div class="b_div">
<div class="button c_button s_button" onclick="submitF..
I am totally new to Selenium. I want to execute a javascript snippet in the following code(as commented in the code), but can't do so. Please help.
from selenium import webdriver
import selenium
from..
On Selenium Webdriver, how I can retrieve text from a span tag & print?
I need to extract the text UPS Overnight - Free
HTML code are as follow:
div id="customSelect_3" class="select_wrapp..
I'm using Firefox 47.0 with Selenium 2.53. Recently they have been a bug between Selenium and Firefox which make code not working. One of the solution is to use the Marionnette driver.
I followed th..
I'm attempting to get the URL of the currently open page. I am using Selenium WebDriver and Java.
I am accessing the current URL via:
WebDriver driver = new WebDriver();
String url = driver.getCurr..
I am currently trying to move the cursor to a point (org.openqa.selenium.Point) that has been set by checking for an occurrence of a marker on a live chart from which I can get no details but can find..
How can I check the checkboxes using an id or XPath expression? Is there a method similar to select by visibletext for a dropdown?
Going through the examples given for all other related questions, I c..
I've been through the xpath tutorials and checked many other posts, hence I'm not sure what I'm missing. I'm simply trying to find the following element by xpath:
<input class="t-TextBox" type="e..
When I am using a proxy in webdriver like FirefoxDriver, if the proxy is bad then the get method will block forever. I set some timeout parameters, but this did not work out.
This is my code:
Firefo..
Currently working on Selenium WebDriver and using Java. I want to select values in date range from the drop down.. I want to know how can I select the values as Date, Month and year in the date picker..
I have a WebElement, I want to reset its an attribute's value to some other value (for e.g. attr is the attribute, and I want to change its original value=1 to new value=10).
Is it possible? I am us..
I'm trying to start a Selenium test with a POST request to my application.
Instead of a simple open(/startpoint)
I would like to do something like open(/startpoint, stuff=foo,stuff2=bar)
Is there a..
I need to check the existence of Alert in WebDriver.
Sometimes it pops up an alert but sometimes it will not pop up. I need to check if the alert exists first, then I can accept or dismiss it or it w..
1)I am doing a tutorial to show how findElements By xpath works. I would like to know why it returns all the texts that following the <div> element with attribute id=container.
code for xpath: ..
I'm looking for more elegant way to refresh webpage during tests (I use Selenium2).
I just send F5 key but I wonder if driver has method for refreshing entire webpage
Here is my code
while(driv..
I know this has been asked lots of times before but how do you get around the "element not interactable" exception?
I'm new to Selenium so excuse me if I get something wrong.
Here is my code:
butto..
I tried this
WebDriver driver = new ChromeDriver();
But I'm getting the error as
Failed tests: setUp(com.TEST): The path to the driver executable must be set by the webdriver.chrome.driver system ..
I'm trying to select an element that includes an anchor, but the text is buried in a paragraph inside of a div. Here's the HTML I'm working with:
<a class="item" ng-href="#/catalog/90d9650a36988e..
I am currently using selenium webdriver to parse through facebook user friends page and extract all ids from the AJAX script. But I need to scroll down to get all the friends. How can I scroll down in..
I am trying to launch Mozilla but still I am getting this error:
Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.dr..
Using Selenium WebDriver with JAVA.
I am trying to automate a functionality where I have to open a new tab do some operations there and come back to previous tab (Parent).
I used switch handle but it'..
When i'm trying to run the test suite, am getting this exception. We are using maven project here and i am done with refreshing, cleaning, reinstalling testNG and then imported the maven projects but ..
I want to scrape all the data of a page implemented by a infinite scroll. The following python code works.
for i in range(100):
driver.execute_script("window.scrollTo(0, document.body.scrollHeigh..
I am converting my selenium 1 code to selenium 2 and can't find any easy way to select a label in a drop down menu or get the selected value of a drop down. Do you know how to do that in Selenium 2?
..
Recently I switched computers and since then I can't launch chrome with selenium. I've also tried Firefox but the browser instance just doesn't launch.
from selenium import webdriver
d = webdriver...
Yes I read this How to find the port for MS SQL Server 2008?
no luck.
telnet 1433
returns connection failed, so I must specify other port.
I tried to use
netstat -abn
but I don't see sql..
’ is showing on my page instead of '.
I have the Content-Type set to UTF-8 in both my <head> tag and my HTTP headers:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-..
I am attempting to use the libtommath library. I'm using the NetBeans IDE for my project on Ubuntu linux. I have downloaded and built the library, I have done a 'make install' to put the resulting .a ..
I need a valid method to check if a String represents a path for file or a directory. What are valid directory names in Android? As it comes out, folder names can contain '.' chars, so how does system..
I am having trouble with a React form and managing the state properly. I have a time input field in a form (in a modal). The initial value is set as a state variable in getInitialState, and is passed ..
I'm trying to connect each @Repositories to different DataSource(s) with Spring Boot and Spring Data JPA. I used the following, http://xantorohara.blogspot.com/2013/11/spring-boot-jdbc-with-multiple.h..
I want to convert String to Date in different formats.
For example,
I am getting from user,
String fromDate = "19/05/2009"; // i.e. (dd/MM/yyyy) format
I want to convert this fromDate as a Date ..
I have a button like the following,
<asp:Button ID="pagerLeftButton" runat="server" OnClientClick="disable(this)" onclick="pager_Left_Click" Text="<" />
When I use my button like that, onc..
I have a .zip file and need to unpack its entire content using Powershell. I'm doing this but it doesn't seem to work:
$shell = New-Object -ComObject shell.application
$zip = $shell.NameSpace("C:\a.z..
I am using the last version react-router module, named react-router-dom, that has become the default when developing web applications with React. I want to know how to make a redirection after a POST ..
i am using the following code for phone number validation. But i am getting the following error. I cant able to proceed further. Help us to take it forward.
class PhoneNumberValidation: Validation {
..
In PostgreSQL I have a table with a varchar column. The data is supposed to be integers and I need it in integer type in a query. Some values are empty strings.
The following:
SELECT myfield::integer..
I don't know if this is possible in Linq but here goes...
I have an object:
public class User
{
public int UserID { get; set; }
public string UserName { get; set; }
public int GroupID { get; s..
I get some error that I can't figure out. Any clue what is wrong with my sample code?
class B:
def meth(self, arg):
print arg
class C(B):
def meth(self, arg):
super(C, self)...
Does any standard "comes with batteries" method exist to clear the terminal screen from a Python script, or do I have to go curses (the libraries, not the words)?..
Is there a way to get the entire contents of a single column using Entity Framework 4? The same like this SQL Query:
SELECT Name FROM MyTable WHERE UserId = 1;
..
How can I handle an onchange for <input type="number" id="n" value="5" step=".5" /> ? I can't do a keyup or keydown, because, the user may just use the arrows to change the value. I would want ..
I installed nodejs in C:\Program Files (x86)\nodejs
then I created a .js file and saved it in my desktop just to output 'hello world' in the console:
console.log('hello world');
When I tried to ru..
First of all, this question asks a very similar question. However, my question has a subtle difference.
What I'd like to know is whether it is possible to programmatically change the colorPrimary att..
How should I rename my current file in Vim?
For example:
I am editing person.html_erb_spec.rb
I would like it renamed to person.haml_spec.rb
I would like to continue editing person.haml_spec.rb
H..
I've searched and I can only find questions about the other way around: writing stdin to a file :)
Is there a quick and easy way to dump the contents of a file to stdout?..
I was wondering if there is a way in angular to conditionally display content other than using ng-show etc. For example in backbone.js I could do something with inline content in a template like:
<..
I've created a utility R script, util.R, which I want to use from other scripts in my project.
What is the proper way to ensure that the function this script defines are available to function in my ot..
I am trying to add some form elements dynamically via Ajax with jQuery.
I want to make sure that I don't create the same element twice, so I only want to add it if it hasn't already been added to the ..
I am running a program that I've written in Java in Eclipse. The program has a very deep level of recursion for very large inputs. For smaller inputs the program runs fine however when large inputs ar..
I have a network call to be executed. But before doing that I need to check whether the device have internet connectivity.
This is what i have done so far:
var connectivityResult = new Connectivit..
I've designed a page, where buttons look good when the browser zoom is at 90%, but by default other users view it at 100/125%+ in their browser which is resulting an overlap in buttons and input forms..
How can I stash a specific file leaving the others currently modified out of the stash I am about to save?
For example, if git status gives me this:
younker % gst
# On branch master
# Your bra..
I was wondering if there was a built-in function in R that would compute the standard deviation for columns just like colMeans computes mean for every column. It would be simple enough to write my own..
I am new to socket programming and I am trying to understand the operation of htons(). I've read a few tutorials on the Internet like this and this one for instance. But I couldn't understand what ht..
In my JavaScript code I need to compose a message to server in this format:
<size in bytes>CRLF
<data>CRLF
Example:
3
foo
The data may contain unicode characters. I need to send them..
I trying to add a custom filter, but if I use the following code:
angular.module('myApp',[]).filter('startFrom', function() {
return function(input, start) {
start = +start; //parse to in..
The obvious answer is to use Charset.defaultCharset() but we recently found out that this might not be the right answer. I was told that the result is different from real default charset used by java...
I am trying to plot information against dates. I have a list of dates in the format "01/02/1991".
I converted them by doing the following:
x = parser.parse(date).strftime('%Y%m%d'))
which gives 19..
I'd like to know if the POST method on HTTP sends data as a QueryString, or if it use a special structure to pass the data to the server.
In fact, when I analyze the communication with POST method f..
I have a *.mp4 video file(MPEG4 video codec) and I am trying to convert this to a H264 video codec format(raw h.264 format) using ffmpeg on Linux(Version - FFmpeg version SVN-r0.5.1-4:0.5.1-1ubuntu1, ..
Is a URI (specifically an HTTP URL) allowed to contain one or more space characters? If a URL must be encoded, is + just a commonly followed convention, or a legitimate alternative?
In particular, ..
Is there any shortcut to rename a component with the Angular CLI other than manually editing all the component files such as folder name, .css, .ts, spec.ts and app.module.ts? ..
I have a JSON array of objects that I'm trying to convert to YAML.
{"AAPL": [
{
"shares": -75.088,
"date": "11/27/2015"
},
{
"shares": 75.088,
"date": "11/26/2015"
},
]}
Is..
I need to get the package name of an Android APK. I have tried to unzip the APK and read contents of AndroidManifest.xml, but seems it's not a text file.
How can I extract the APK's package name?..
It is my first Twitter Bootstrap experience. I have added some headings (h1, h2, etc.) and they are aligned by left side. What is the right way to center headings?..
I have some questions about how to link things.
Imagine that I have a folder "Website" where my files for that website are stored, and another folder with fonts, and that the font folder has more fol..
I'm using C++ (not C++11). I need to make a pointer to a function inside a class. I try to do following:
void MyClass::buttonClickedEvent( int buttonId ) {
// I need to have an access to all memb..
I am playing around with MongoDB trying to figure out how to do a simple
SELECT province, COUNT(*) FROM contest GROUP BY province
But I can't seem to figure it out using the aggregate function. I c..
I am trying to get my first TypeScript and DefinitelyTyped Node.js application up and running, and running into some errors.
I am getting the error "TS2304: Cannot find name 'require' " when I attemp..
I am using a library which on call of a function returns the toString of a buffer.
The exact code is
return Buffer.concat(stdOut).toString('utf-8');
But I don't want string version of it.
I just..
One simple question: is it possible to return a value in AsyncTask?
//AsyncTask is a member class
private class MyTask extends AsyncTask<Void, Void, Void>{
protected Void doInBackground(Vo..
I'm using AngularJS $http on the client side to access an endpoint of a ASP.NET Web API application on the server side. As the client is hosted on a different domain as the server, I need CORS. It wor..
Is it possible, in PHP, to flatten a (bi/multi)dimensional array without using recursion or references?
I'm only interested in the values so the keys can be ignored, I'm thinking in the lines of arra..
Is there any Twitter Bootstrap class for font-weight: bold and other values of font-weight?
I would not create a new one if this already exists in Bootstrap...
How can I continuously capture images from a webcam?
I want to experiment with object recognition (by maybe using java media framework).
I was thinking of creating two threads
one thread:
Node 1..
As I know getHours(), getMinutes() and getSeconds() are all deprecated in Java and they are replaced with Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND.
These will in fact return the hour, m..
I'm following along with:
The Node Beginner Book
After testing with the code from another SO post:
var Fs = require('fs');
var dirs = ['tmp'];
var index;
var stats;
for (index = 0; index < dir..
I have a bunch of float: left elements and some are SLIGHTLY bigger than others. I want the newline to break and have the images float all the way to the left instead of getting stuck on a bigger elem..
I was trying to create an image gallery with Angular 4.The logic behind this is to add a Cascading Style Sheet (CSS) class to the selected image that will show a red border on the selected (clicked) i..
I have two DateTime vars, beginTime and endTime. I have gotten the difference of them by doing the following:
TimeSpan dateDifference = endTime.Subtract(beginTime);
How can I now return a string of..
The following print statement would print "hello world".
Could anyone explain this?
System.out.println(randomString(-229985452) + " " + randomString(-147909649));
And randomString() looks like this..
I would like to enable all apt repositories in this file
cat /etc/apt/sources.list
## Note, this file is written by cloud-init on first boot of an instance ..
Is there a way to change all the numeric keys to "Name" without looping through the array (so a php function)?
[
0 => 'blabla',
1 => 'blabla',
2 => 'blblll',
// etc ..
I know there are a plethora of $_SERVER variables headers available for IP address retrieval. I was wondering if there is a general consensus as to how to most accurately retrieve a user's real IP add..
To declare multiple variables at the "same time" I would do:
a, b = True, False
But if I had to declare much more variables, it turns less and less elegant:
a, b, c, d, e, f, g, h, i, j = True, Tr..
I want to change Accept-language request header to anything I wanted in chrome, is there any extension or plugin where I can do it. I want to be able to change locale and language both. Main requireme..
I have tried the following code, but it doesn't work. Any idea where I have gone wrong?
_x000D_
_x000D_
document.getElementsByClassName('appBanner').style.visibility='hidden';_x000D_
<div class="a..
I want to write a php page in which there is a html form. I want to send all input (number for example) of my form to a php function (instead of a javascript function; I make this to hide my javascrip..
I just installed Dev C++ and I am learning C programming.
the code i used was
#include <stdio.h>
int main()
{
printf("Hello world");
getch();
}
I saved it as a .c file. When I compil..
So up until now, i have created classes and modules in node.js the following way:
var fs = require('fs');
var animalModule = (function () {
/**
* Constructor initialize object
* @c..
After a new user submits a 'New account' form, I want to manually log that user in so they don't have to login on the subsequent page.
The normal form login page going through the spring security int..
I am using vscode with Prettier 1.7.2 and Eslint 1.7.0. After every newline I get:
[eslint] Delete 'cr' [prettier/prettier]
This is the .eslintrc.json:
{
"extends": ["airbnb", "plugin:prettier/r..
This question seems like a duplicate but it's really not. Just a slight difference that keeps on repeating. git keeps on telling me: "please tell me who you are", even after setting it up. when I run ..
I want that part 1 onclick div style changes and part 2 again on click it comes back to normal. I tried doing so but I failed to achieve the part 2 results.
Following is the Javascript code
functio..
I am able to draw checkbox in Github README.md lists using
- [ ] (for unchecked checkbox)
- [x] (for checked checkbox)
But this is not working in table. Does anybody know how to implement checkbox ..
I have a text file test.txt with the following content:
text1
text2
And I want to assign the content of the file to a UNIX variable, but when I do this:
testvar=$(cat test.txt)
echo $testvar
t..
i've made an assembly in the .net framework that I intend to publish to the GAC but I can't find the gacutil utlity.
I've been googling a while and I've found a lot of suggestions, but nothing works:..
I would like to be able to trap CTRL+C in a C# console application so that I can carry out some cleanups before exiting. What is the best way of doing this?..
How do I add a custom header to a HttpClient request? I am using PostAsJsonAsync method to post the JSON. The custom header that I would need to be added is
"X-Version: 1"
This is what I have don..
I am getting Java exception like:
java.net.MalformedURLException: no protocol
My program is trying to parse an XML string by using:
Document dom;
DocumentBuilderFactory dbf = DocumentBuilderFacto..
I am creating a dictionary in a C# file with the following code:
private readonly Dictionary<string, XlFileFormat> FILE_TYPE_DICT
= new Dictionary<string, XlFileFormat>
{
..
I am a bit of confused about Parallel.ForEach.
What is Parallel.ForEach and what does it exactly do?
Please don't reference any MSDN link.
Here's a simple example :
string[] lines = File.ReadAllL..
This is what I'm trying to do for several hours:
I've got a MainActivity.java file (listing below) and a fragment_start.xml file with a start button. Tapping the start-button should display the activi..
I have two textboxes. One for a clock in time and one for clock out. The times will be put in this format:
Hours:Minutes
Lets say I have clocked in at 7:00 AM and clocked out at 2:00 PM.
With my c..
I have problem with Bash, and I don't know why.
Under shell, I enter:
echo $$ ## print 2433
(echo $$) ## also print 2433
(./getpid) ## print 2602
"getpid" is a C program to get current pid, lik..
Possible Duplicate:
I have a nested data structure / JSON, how can I access a specific value?
I have a json object, like the one below:
[
["Blankaholm", "Gamleby"],
["2012-10-23", "201..
I updated from VSCode 0.10.6 to 0.10.8, and tried using Typescript for the first time. Unfortunately I when I tell VSCode to build, I get the error:
tsc is not a recognized as an internal or externa..
i have a start date string "20.03.2014" and i want to add 5 days to this with moment.js but i don't get the new date "25.03.2014" in the alert window.
here my javascript Code:
startdate = "20.03.201..
I'm building a container for a ruby app. My app's configuration is contained within environment variables (loaded inside the app with dotenv).
One of those configuration variables is the public ip of..
I have a very large database (50+ GB). In order to free space in my hard drive, I tried deleting old records from one of the tables . I ran the command:
delete from Table1 where TheDate<'2004-01-0..
I would like to create a data.frame in R with m (a variable) number of columns (for example 30), and 2 rows and fill all the values in the data.frame initially with 0's. It seems as though data.frame ..
In this simple example, I'm trying to set a CSP header with the meta http-equiv header. I included a base64 image and I'm trying to make Chrome load the image.
I thought the data keyword should do th..
I have an application that I just would like to use in portrait mode, so I have defined
android:screenOrientation="portrait" in the manifest XML. This works OK for the HTC Magic phone (and prevents or..
So if I have two sets:
Set<Integer> test1 = new HashSet<Integer>();
test1.add(1);
test1.add(2);
test1.add(3);
Set<Integer> test2 = new HashSet<Integer>();
test2.add(1);
test2..
I've got a gradle FAILURE:
..."Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0."
Case description:
Attached to the project codebase the next libs:
APP..
Have output from sed:
http://sitename.com/galleries/83450
72-profile
Those two strings should be merged into one and separated with space like:
http://sitename.com/galleries/83450 72-profile
Two..
I want to extract just the date part from a timestamp in PostgreSQL.
I need it to be a postgresql DATE type so I can insert it into another table that expects a DATE value.
For example, if I have 20..
I want to discover bluetooth devices in range, list and pair to them on click. I used following code but its just closing application when I click on device name which I want to pair.
I want to know ..
I've got a dictionary:
mydict = {key1: value_a, key2: value_b, key3: value_c}
I want to write the data to a file dict.csv, in this style:
key1: value_a
key2: value_b
key3: value_c
I wrote:
impo..
I'm a newbie in VBA and Macros. If someone helps me with VBA code and macros, it will be helpful.
Daily I'll receive around 50-60 mails with one standard subject: "Task Completed". I have created a r..
What's the difference between ECMAScript and JavaScript? From what I've deduced, ECMAScript is the standard and JavaScript is the implementation. Is this correct?..
When using the xhtml1-transitional.dtd doctype, collecting a credit card number with the following HTML
<input type="text" id="cardNumber" name="cardNumber" autocomplete='off'/>
will flag a w..
First some code:
import java.util.*;
//...
class TicTacToe
{
//...
public static void main (String[]arg)
{
Random Random = new Random() ;
toerunner () ; // this leads to a path of ..
I have an array of numbers that I need to make sure are unique. I found the code snippet below on the internet and it works great until the array has a zero in it. I found this other script here on St..
Possible Duplicate:
How to access PHP variables in JavaScript or jQuery rather than <?php echo $variable ?>
Is there any way to get access to a PHP variable in JavaScript?
I have a v..
I am looking to write an app that receives pushed alerts from a server. I found a couple of methods to do this.
SMS - Intercept the incoming SMS and initiate a pull from the server
Poll the server..
I tried to truncate a table with foreign keys and got the message:
"Cannot truncate table because it is being referenced by a FOREIGN KEY constraint".
I read a lot of literature about the prob..
Whenever a user reports an error such as
System.Runtime.InteropServices.SEHException - External component has thrown an exception?
is there anything that I as a programmer can do to determine t..
Is it possible to run a PHP app using tomcat?
Before you tell me to just use httpd, I already have a Java application running on my webserver at host/myapp. Now I want to install RoundCube at host/ro..
We use tags in git as part of our deployment process. From time to time, we want to clean up these tags by removing them from our remote repository.
This is pretty straightforward. One user deletes..
I am thinking this may not be possible in Java because annotation and its parameters are resolved at compile time. I have an interface as follows,
public interface FieldValues {
String[] FIELD1 = ..
Can you show me Javascript that allows you to change the background color of the page to another color. For example, I have a blue background color and I want to change it to green. The color must be ..
I want to insert the integers 188 and 90 in my MySQL database, but the following code doesn't work:
import MySQLdb
conn = MySQLdb.connect(host= "localhost",
user="root",
..
I am writing a project in Django and I see that 80% of the code is in the file models.py. This code is confusing and, after a certain time, I cease to understand what is really happening.
Here is what..
When I run my project, I get numerous outputs of this error:
Sep 9, 2009 8:22:23 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet Jersey threw exception
..
What is the differenct between those two:
var year = moment().format('YYYY');
var year = moment().year();
Is it just type of or anything else? I am just curious...
How do I share a global variable with thread?
My Python code example is:
from threading import Thread
import time
a = 0 #global variable
def thread1(threadname):
#read variable "a" modify by t..
I learned that memset(ptr, 0, nbytes) is really fast, but is there a faster way (at least on x86)?
I assume that memset uses mov, however when zeroing memory most compilers use xor as it's faster, co..
On our internal network, we use a self-signed CA certificate. This has worked fine for years, in both Safari and our iOS product, all the way through iOS 10. We simply install the CA certificate on an..
I want to create a dictionary whose values are lists. For example:
{
1: ['1'],
2: ['1','2'],
3: ['2']
}
If I do:
d = dict()
a = ['1', '2']
for i in a:
for j in range(int(i), int(i) + 2..
I am new to JavaScript/jQuery and I've been learning how to make functions. A lot of functions have cropped up with (e) in brackets. Let me show you what I mean:
$(this).click(function(e) {
// do..
I'm trying to do something like a C #include "filename.c", or PHP include(dirname(__FILE__)."filename.php") but in javascript. I know I can do this if I can get the URL a js file was loaded from (e.g...
I'm trying to get a jQuery component similar to the one on this site.
Basically, there is a list with available elements that you can drag and drop into several blocks.
I have quite a bit of JavaScr..
I want to generate the javadocs for an open-source code-base I'm using. But I'm being asked for a "Javadoc Command" by the Eclipse Generate JavaDoc wizard and the help doesn't explain what this means...
In my web application, I want to retrieve data from database based on the value that is passed to the function. I wrote the query as follows.
<script>
//Functions to open database and to crea..
I want to send some data in json format to php and do some operation in php. My problem is i can't send json data via ajax to my php file.Please help me how can i do that. I have tried this way..
<..
I am trying to create a responsive grid of images (with descriptions) that when moused over will have a color overlay (just the image and not the text). Because of the responsive heights of the images..
Is there anyone who knows how to connect a picture with the cell that it is in at microsoft excel?
For example in the first column I put some brands of mobile phones and in the second one some pictur..
I used PuTTY Key Generator to generate a 4096 bit RSA-2 key with a passphrase.
I save the .ppk and an openSSL format public key. The putty format public key doesn't work.
In any case, my error is as..
I'm currently trying to write some JavaScript to get the attribute of the class that has been clicked. I know that to do this the correct way, I should use an event listener.
My code is as follows:
..
I am having problems with Wamp Server, the icon will never turn green. It is constantly stuck at orange.
I have tried many ways, editing HOSTS file, .config files, disabling IIS, changing SKYPE's por..
Brand new to jQuery.
I was trying to set up an event listener for the following control on my page which when clicked would display an alert:
<input type="button" id="filter" name="filter" value="..
I have this anchor and on click I would like to popup something.
This href is within a page that has other hrefs.
<a class="sign_new" href="#sign_up">Sign up</a>
jQuery:
$(document).re..
I've been trying to get an efficient regex for IPv4 validation, but without much luck. It seemed at one point I had had it with (25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?(\.|$)){4}, but it produces some st..
I am looking for a way to convert a long string (from a dump), that represents hex values into a byte array.
I couldn't have phrased it better than the person that posted the same question here.
But..
What is the Pythonic approach to achieve the following?
# Original lists:
list_a = [1, 2, 3, 4]
list_b = [5, 6, 7, 8]
# List of tuples from 'list_a' and 'list_b':
list_c = [(1,5), (2,6), (3,7), (4..
I have a Column widget with two TextField widgets as children and I want to have some space between both of them.
I already tried mainAxisAlignment: MainAxisAlignment.spaceAround, but the result was ..
I'd like to add an image icon to an input placeholder, like in this picture:
Please note that this is a placeholder, so when the user starts typing, the icon also disappears.
I came with the follow..
I want to run a python file in my command prompt but it does nothing.
These are the screen shots of my program i am testing with and the output the command prompt gives me.
..
What I am looking for is how to read an integer that was given by the user from the command line (console project). I primarily know C++ and have started down the C# path. I know that Console.ReadLine..
I have a C# code which does lot of insert statements in a batch. While executing these statements, I got "String or binary data would be truncated" error and transaction roledback.
To find out the w..
I'm interested in building a small app for personal use that will encrypt and decrypt information on the client side using JavaScript. The encrypted information will be stored in a database on a serv..
I've configured android-P SDK environment successfully. When I attempt to use the android design support library I face project build errors. Project configurations are:
IDE: 3.2 Canary 17 Target API..
After I upgraded to the latest stable node and npm, I tried npm install moment --save. It saves the entry in the package.json with the caret ^ prefix. Previously, it was a tilde ~ prefix.
Why are the..
I'm trying to send/receive data over an USB Port using FTDI, so I need to handle serial communication using C/C++. I'm working on Linux (Ubuntu).
Basically, I am connected to a device which is listen..
I've been encountering a strange bug in Visual Studio 2010 for some time now.
I have a solution consisting of a project which compiles to a static library, and another project which is really simple ..
def play_game(word_list):
hand = deal_hand(HAND_SIZE) # random init
while True:
cmd = raw_input('Enter n to deal a new hand, r to replay the last hand, or e to end game: ')
if ..
How can I inspecting PDF files, preferable with a tool?
Use case: I'm trying to programmatically generate PDF files (using iText). I'm having trouble achieving certain layouts, but I have PDF files w..
How to make a responsive google map from the code
<div class="map">
<iframe>...</iframe>
</div>
I use in css for full map
.map{max-width:100%;}
and small device
...
I'm attempting to use jQuery to capture a submit event and then send the form elements formatted as JSON to a PHP page.
I'm having issues capturing the submit though, I started with a .click() event b..
When you call RedirectToAction within a controller, it automatically redirects using an HTTP GET. How do I explicitly tell it to use an HTTP POST?
I have an action that accepts both GET and POST req..
How do I determine whether a given integer is between two other integers (e.g. greater than/equal to 10000 and less than/equal to 30000)?
I'm using 2.3 IDLE and what I've attempted so far is not worki..
I need the code for validating email and mobile number in jQuery and also focus() on that particular field where validations are not satisfied.
This is my query
<form name="enquiry_form" method=..
I am using DateTime.Now in my Excel Macro to show the current timestamp.
It shows timestamp in "dd-MM-yyyy hh:mm:ss" format.
Instead, how can I get the timestamp in "yyyy-MM-dd hh:mm:ss" format?..
I'm not able to install pip in Docker.
Here's my Dockerfile:
FROM ubuntu:14.04
# Install dependencies
RUN apt-get update -y
RUN apt-get install -y git curl apache2 php5 libapache2-mod-php5 php5-mcr..
An update SQL query was executed on the server, which caused many problems later.
How can I get the list of update queries executed in last 2 months, so that I can trace the exact problematic SQL que..
I need a database of every single valid word in English. I checked the /usr/share/dict/words file, it contains less than 100k words. Wikipedia says English has 475k words. Where do I get the complete..
If a variable is declared as static in a function's scope it is only initialized once and retains its value between function calls. What exactly is its lifetime? When do its constructor and destructor..
I want to setup a hadoop-cluster in pseudo-distributed mode. I managed to perform all the setup-steps, including startuping a Namenode, Datanode, Jobtracker and a Tasktracker on my machine.
Then I tr..
I created a solution in Visual C# 2010 Express that contains two projects: one is the client, the other is the server. I would like to debug both at the same time, but I can only seem to run one of th..
Say I have a website called a.com, and when a specific page of this site is loaded, say page link, I like to set a cookie for another site called b.com, then redirect the user to b.com.
I mean, on l..
I would like in my application to find a way to synch the date and time with something given by an external source.
I don't want to use the phone time because I might get a difference of maybe 5 minu..
I am using spring data and my DAO looks like
public interface StudentDAO extends JpaRepository<StudentEntity, Integer> {
public findAllOrderByIdAsc(); // I want to use some thing like thi..
I have a homework assignment and I was wondering if anyone could help me as I am new to Java and programming and am stuck on a question. The question is:
The first method finds the average of the el..
I have MacVim installed and I am trying to set it up as the editor for Git (version control), but I can't run 'mvim' from the command line as it isn't recognised. How do I setup mvim so I can run it ..
Apart from the fact that HashSet does not allow duplicate values, what is the difference between HashMap and HashSet?
I mean implementation wise? It's a little bit vague because both use hash tables ..
I was reading about sql injection and i understand how it works if there is a form where the user can enter his username and login. What i dont get is how websites without a login page can be vulnerab..
I know about the HIG (which is quite handy!), but what programming practices do you use when writing Objective-C, and more specifically when using Cocoa (or CocoaTouch)...
I'm having a problem with a library that I am using. It might be the library or it might be me using it wrong!
Basically, when I do this (Timeout in milliseconds)
_ignitedHttp.setConnectionTimeout(1..
I'm trying to connect to a PostgreSQL 9.1 database using Oracle SQL Developer 3.0.04, but I'm not having any success so far.
First, if I add a third party driver on preferences, when adding a new con..
I downloaded a PHP script written using CodeIgniter. when I run it from the localhost, on going to the admin folder, it shows localhost again. Also when running from my web host, it shows a 500 Intern..
I add an API with following script in let's say http://www.test.com:
<script src="http://apiendpoint.com/api/v1/api.js"></script>
<div id="api" data-apikey="LA59CJI9HZ-KIJK4I5-3CKJC"&..
My dictionary looks like this(Dictionary within a dictionary):
{'0': {
'chosen_unit': <Unit: Kg>,
'cost': Decimal('10.0000'),
'unit__name_abbrev': u'G',
'supplier__supplier': u"..
How to check if an element exist with web driver?
Is using a try catch really the only possible way?
boolean present;
try {
driver.findElement(By.id("logoutLink"));
present = true;
} catch (No..
I have been having trouble setting a box shadow on the left side of an element only.
I tried this:
box-shadow: -10px 0px 3px 0px #aaa;
However, the box shadow looks more like a grey line and lacks..
What is the best way to do a groupby on a Pandas dataframe, but exclude some columns from that groupby? e.g. I have the following dataframe:
Code Country Item_Code Item Ele_Code Unit ..
Can someone explain the differences between ternary operator shorthand (?:) and null coalescing operator (??) in PHP?
When do they behave differently and when in the same way (if that even happens)?
..
Here is the code:
package mscontroller;
import javax.swing.*;
import com.apple.eawt.Application;
public class Main {
public static void main(String[] args)
{
Application app = new A..
Based on this
A positional argument is a name that is not followed by an equal sign
(=) and default value.
A keyword argument is followed by an equal sign and an expression that
gives its..
Using LINQ what is the best way to select a single item from a list if the item may not exists in the list?
I have come up with two solutions, neither of which I like. I use a where clause to select..