• Greg Palios 5
  • NEWBIE
  • 10 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
I have a formula field creates an image (QR Code). The formula works fine and renders correctly in the UI, but when I try to add it to a VF page that generates a PDF, the image is broken. My code snippet:
<apex:outputText value="{!OrderRec.Order_ID_Barcode__c}" escape="false" style="float:right;"/>
This is how it renders:
User-added image
Any ideas on what I do differently? The strange thing is that we have an identitcal piece of code working correctly in our proof of concept org, so I don't know why it's not working on our production sandbox.
Hello,

I am trying to practice using Selenium by doing a simple operation of creating a custom object in Lightning. My code works fine in Classic, but once I switch over to Lightning, for some reason it only works up to a certain point. 

What works:
 
driver.get("http://login.salesforce.com");
driver.manage().window().maximize();		driver.findElement(By.xpath("//input[@id='username']")).sendKeys("<USERNAME>");		driver.findElement(By.xpath("//input[@id='password']")).sendKeys("<PASSWORD>");
driver.findElement(By.xpath("//input[@class='button r4 wide primary']")).click();

driver.findElement(By.xpath("//*[@id=\"oneHeader\"]/div[3]/div/div[2]/div/div/ul[2]/li[3]/div")).click();
driver.findElement(By.xpath("//*[@id=\"oneHeader\"]/div[3]/div/div[2]/div/div/ul[2]/li[3]/div/div[2]")).click();
So I am able to login and access the Object Create page just fine. The issue is with the next bit of code, which should be the easiest:
 
driver.findElement(By.xpath("//input[@id='MasterLabel']")).sendKeys("Address");		driver.findElement(By.xpath("//input[@id='MasterLabel']")).sendKeys("Addresses");
driver.findElement(By.xpath("//input[@value=' Save ']")).click();
I keep getting the error message:
Exception in thread "main" org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//input[@id='MasterLabel']"}
Things I have tried:
  1. Searching for the input boxes via name and id instead of xpath. Same results
  2. Tried implementing an explicit wait. Doesn't seem to make a difference
  3. Tried doing a driver.switchTo().frame() method, but Webdriver can't seem to detect an iFrame on the page.
Any help would be greatly appreciated! Thanks
 
I have a formula field creates an image (QR Code). The formula works fine and renders correctly in the UI, but when I try to add it to a VF page that generates a PDF, the image is broken. My code snippet:
<apex:outputText value="{!OrderRec.Order_ID_Barcode__c}" escape="false" style="float:right;"/>
This is how it renders:
User-added image
Any ideas on what I do differently? The strange thing is that we have an identitcal piece of code working correctly in our proof of concept org, so I don't know why it's not working on our production sandbox.
Hi all, 

i have tried again several hours to find a solution for the following problem. I have a button in the frontend that does not have a unique name nor ID with which i can access it through silenium to click it. Only solution i have is xpath. 

This is the story: 

I try to click the button through this way: 
WebElement myButton = webDriver.findElement(By.xpath("//*[@class='here is the xpath to my button']"));
myButton.click();
it throws an exception saying this: 
</button> is not clickable at point (1851, 325). Other element would receive the click:

i have googled and found 3 possible solutions: 

1. add implicit wait
WebDriverWait wait = new WebDriverWait(webDriver, timeout);
webDriver.manage().timeouts().implicitlyWait(timeout, TimeUnit.SECONDS);
element = wait.until(ExpectedConditions.elementToBeClickable(MYBUTTON));
wait.until(ExpectedConditions.elementToBeClickable(MYBUTTON)); 
MYBUTTON.click();
still the same error from above: </button> is not clickable at point (1851, 325). Other element would receive the click:

2. use action with offset
Actions action = new Actions(webDriver);
action.moveToElement(myButton, 0, -20).contextClick().perform();
action.moveToElement(myButton, 0, -20).click().perform();
action.moveToElement(myButtons, 0, -20).doubleClick().perform();
result: nothing happens. it does not click the element. but context click is shown on the button itself. strange that click does not work. 

3. use javascriptexecutor with offset
((JavascriptExecutor)webDriver).executeScript("window.scrollTo(0,"+clickableAddProduct.getLocation().x+")");
clickableAddProduct.click();
result: still the same error from above: </button> is not clickable at point (1851, 325). Other element would receive the click:

4. execute java script with javascriptexecutor
js.executeScript(	"window.document.getElementByxpath('XPATH TO MYBUTTON').click()");
Result: no such method getElementByxpath exists 

only possible solution i have test is:
- give the button an ID (for example ID="unique ID of MYBUTTON"). during runtime in the inspector of chrome (F12)
- try this below
try {
			// Find the element...
			WebElement element = MYBUTTON;

			// Step 1
			new Actions(webDriver).moveToElement(element).perform();

			// Step 2
			element.click();
		} catch (Exception e) {

			((JavascriptExecutor) webDriver).executeScript("document.getElementById('unique ID of MYBUTTON').click();");

		}

code then it works withe the java script executor line (the one in the exception). i debugged it. worked. 

please can someone help. tried so many ways. frustrating. :(

Thanks
Soheil