I am able to open new console sub tab by below code with salesforce fourmula field.
HYPERLINK("javascript:if(typeof(srcUp)=='function') {srcUp('/apex/NSTK_SW_PeriodToPeriodFrom?scontrolCaching=1&id="&Id&"&isdtp=vw');}"+ " else {window.location.href='/apex/NSTK_SW_PeriodToPeriodFrom?scontrolCaching=1&id="&Id&"&isdtp=vw'}", "Reimbursement Statement", "_parent" )
but below I want to open below code in new subtab.... This is also a salesforce formula field with id instead of apex page which is the case above. This is opening in new tab of browser instead of console new tab.
HYPERLINK("/00O0j000000FNko?pv0="+Id,"Reimbursement Report","_blank")
Any kind of help is highly appreciated.
try using "_self" in place of "_blank". This will open under same sub tab
Related
I have an existing PDF which I want to open at specific bookmarks in a WPF application. Below is the snippet of code I'm using:
Dim myProcess As Process = New Process()
myProcess.StartInfo.FileName = "AcroRd32.exe"
myProcess.StartInfo.Arguments = "/n /A ""pagemode=bookmarks&nameddest=Holidays"" ""c:\Classic\Manual\DocumentationManual.pdf"""
myProcess.Start()
The PDF opens in bookmark mode but not at the specified destination
bookmark (Holidays in the example above).
Can anyone help me resolve this issue?
In wordpress site,I am opening a link in a new tab to add a new post, I am able to enter the post title but not able to click on publish button. I have tried all possible locators id, xpath...etc.
can someone help me understand this issue. This screenshot shows page after i open link in new tab.
Here is my sample code:
driver.get("http://localhost/wordpress/wp-login.php");
driver.manage().window().maximize();
driver.findElement(By.id("user_login")).sendKeys("admin");
driver.findElement(By.id("user_pass")).sendKeys("q1w2e3r4");
driver.findElement(By.id("wp-submit")).click();
Actions actions = new Actions(driver);
WebDriverWait wait = new WebDriverWait(driver,10);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(".//*[#id='welcome-panel']/div/div/div[2]/ul/li[1]/a")));
actions.keyDown(Keys.CONTROL).perform();
actions.keyDown(Keys.SHIFT).perform();
driver.findElement(By.xpath(".//*[#id='welcome-panel']/div/div/div[2]/ul/li[1]/a")).click();
actions.keyUp(Keys.SHIFT);
actions.keyUp(Keys.CONTROL);
driver.findElement(By.id("title")).sendKeys("TestPost"); //Working
driver.findElement(By.id("publish")).click(); //not working
Thanks in advance
I need to downlond csv file from my application. In my application there is table which contains rows and on right click of that row it display download option , on click on of that download it displays windows popup with open and save button.
To download csv from my application i have written below code but which is not working :(
WebDriver driver;
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("browser.download.dir", "c:\\test");
profile.setPreference("browser.download.folderList", 2);
profile.setPreference("browser.helperApps.neverAsk.saveToDisk","text/csv");
profile.setPreference("browser.download.useDownloadDir", false);
profile.setPreference("browser.download.manager.showWhenStarting", false);
driver = new FirefoxDriver(profile);
driver.get("Application link");
// Steps to click on Download file
Please Help.![enter image description here][1]
Try adding
profile.setPreference("browser.download.downloadDir", "c:\\test");
profile.setPreference("browser.download.defaultFolder", "c:\\test");
In addition - csv can come in many content types, not just text/csv..
Try using Firefox addon like HTTP headers to see the exact type the response.
Using selenium web-driver I am trying to put region name In the text box In new popup screen and click on save button. I using the below script for that
String mainWindowHandle1=driver.getWindowHandle();
driver.switchTo().window(mainWindowHandle1 );
driver.findElement(By.id("MainContent_imgAddRegion")).click();
Thread.sleep(5000);
java.util.Set<String> s1 = driver.getWindowHandles();
Iterator<String> ite1 = s1.iterator();
while(ite1.hasNext())
{
String popupHandle=ite1.next().toString();
if(!popupHandle.contains(mainWindowHandle1))
{
driver.switchTo().window(popupHandle).findElement(By.id("txtRegionName")).sendKeys("South Region");
Thread.sleep(3000);
driver.findElement(By.id("txtRegionName")).sendKeys("South Region");
Thread.sleep(1000);
driver.findElement(By.id("btnSave")).click();
By doing this I am able to open the new popup screen to enter the region but, I am unable to send keys [region name] and save the text.Even I am not getting any failed report when I run the test.
This may be due to iFrames presence.
Look in the HTML code and check if the text field that you are trying to send keys to and the save button are included in some sort of iFrame.
If so, you will need to do something like:
driver.switchTo().defaultContent();
driver.switchTo().frame("framename");
driver.findElement(By.id("txtRegionName")).sendKeys("South Region");
driver.findElement(By.id("btnSave")).click();
Hope it helps!
I am trying to automate a file uploading using webdriver, my HTML is
it is of type file.
using firebug i got the id and it is same for textbox and button.
by using this command getWebDriverObj().findElement(By.id("fileupload")).sendKeys("code.txt"); am unable to fetch the result.
does any one faced this type of situation, if so can you please help me.
Thanks
Raghuram.
Autois Windows specific only.
Here is a more robust solution:
For this you will have find the "id" of the actual input box (where the path of the file is provided) and then use the following command:
driver.findElement(By.id("upload")).sendKeys("/path/to/the/file");
driver.findElement(By.id("upload_button")).click();
If you are using WebDriverBackedSelenium you can use:
selenium.type("locator", "/path/to/the/file");
selenium.click("upload_button");
If previous method is not working
You can try next chain.
1. Call File Select Dialog by click button (use webdriver method click() or javascript "document.getElementById('id').click()"
2. And send control to Autoit (or something another) and AutoIt will work with File Select Dialog (type addres to file, click button)
For example:
var Autoit = new AutoItX3();
const string widowTitle = "File Upload";
Autoit.WinWait(widowTitle, "File &name:", 10);
Autoit.ControlSetText(widowTitle, "", "[CLASS:Edit; INSTANCE:1]", pathToFile);
Autoit.ControlClick(widowTitle, "", "[CLASS:Button; INSTANCE:1]");
Autoit.WinWaitClose(widowTitle, "File &name:", 10);
Setup java and AutoIt http://code.google.com/p/autoitx4java/