Issues when uploading data to Google Alerts - google-alerts

I am trying to upload a list of companies to Google Alerts, but getting this error:
CasperError: Errors encountered while filling form: Unable to find field element in form: FieldNotFound: setField: Invalid field ; only HTMLElement is supported
/Users/sam/Documents/Work/google-alerts-export-import/phantomjs:/platform/casper.js:837 in fillForm
/Users/sam/Documents/Work/google-alerts-export-import/phantomjs:/platform/casper.js:930 in fillSelectors
/Users/sam/Documents/Work/google-alerts-export-import/phantomjs:/code/galerts.js:229
/Users/sam/Documents/Work/google-alerts-export-import/phantomjs:/platform/casper.js:1637 in runStep
/Users/sam/Documents/Work/google-alerts-export-import/phantomjs:/platform/casper.js:414 in checkStep
Here's the sample.csv file data:
Apple;At most once a week;Blogs;English;Argentina;All results;RSS feed
And I run it as:
casperjs galerts.js import --file=sample.csv --delete-others
Here's the Github for the program:
https://github.com/jra11/google-alerts-export-import

This happens due to mismatch in versions of library, downgrade casper.

Related

what might be the reason for selenium working for xpath sometimes but sometimes fail to identify the xpath?

def linkdin_login(company_name,username,password):
driver.get('https://linkedin.com/')
driver.find_element(By.XPATH,'//*[#id="session_key"]').send_keys(username)
driver.find_element(By.XPATH,'//*[#id="session_password"]').send_keys(password)
driver.find_element(By.XPATH,"//button[#class='sign-in-form__submit-button']").click()
#def company_info(company_name):
element = driver.find_element(By.CSS_SELECTOR,"#global-nav-typeahead > input")
element.send_keys(company_name)
element.send_keys(Keys.ENTER)
driver.implicitly_wait(10) # seconds
driver.get(driver.find_element(By.CSS_SELECTOR,".search-nec__hero-kcard-v2 > a:nth-child(1)").get_attribute("href"))
driver.implicitly_wait(10)
people()
by the above code i am logging into LinkedIn and fetching the LinkedIn page of the some companies after getting the page I am trying to get the employee data by using people function show below
def people():
driver.implicitly_wait(10)
driver.get(driver.find_element(By.XPATH,"/html/body/div[5]/div[3]/div/div[2]/div/div[2]/main/div[1]/section/div/div[2]/div[1]/div[2]/div/a").get_attribute("href"))
driver.implicitly_wait(10)
people = driver.find_element(By.XPATH,"/html/body/div[4]/div[3]/div[2]/div/div[1]/main/div/div/div[2]/div/ul")
people_data = people.find_elements(By.TAG_NAME,"li")
for i in people_data:
print(i.text)
in this function i am trying to access the link to employees data
that is where the problem lies
the line 2 of people function i trying to get the link the problem is due to some reason sometimes i am getting the link(not to frequently!!) but most of the time i am getting the error saying Xpath not found
i didn't know how to attach a html page so i am attaching the link
([https://www.linkedin.com/company/google/](https://www.stackoverflow.com/)
1. I tried implicit wait assuming that the program is trying to access the Xpath during loading of the page

Lighthouse Error: LHR failed to render in Angular SSR

I am trying to run a lighthouse performance audit on an Angular SSR yet it returns an empty page. No error messages or anything.
However, if I run it on https://pagespeed.web.dev/ it says Core Web Vitals Assessment: Failed and Error: LHR failed to render. But it does show me the data from the previews 28 days.
If I run the lighthouse CLI I am able to get the JSON report but it will also not render an HTML version and does not seem to show any errors.
"lighthouse https://daomaker.com --output=json --output-path=./report.json --save-assets --only-categories=performance"
It returns 3 files, report-0.devtoolslog.json report-0.trace.json report.json
If I open the empty HTML tab and look at the HTML I get this console error:
compiled-reportrenderer.js:92 Uncaught TypeError: Cannot read properties of null (reading 'toString')
at Function.render (compiled-reportrenderer.js:92:2125)
at z.renderNode (compiled-reportrenderer.js:108:6424)
at z._renderTableValue (compiled-reportrenderer.js:108:2467)
at z._renderTableRow (compiled-reportrenderer.js:108:4484)
at z._renderTableRowsFromItem (compiled-reportrenderer.js:108:4755)
at z._renderTable (compiled-reportrenderer.js:108:5510)
at z.render (compiled-reportrenderer.js:108:266)
at F.populateAuditValues (compiled-reportrenderer.js:66:1478)
at F.renderAudit (compiled-reportrenderer.js:66:357)
at compiled-reportrenderer.js:129:4656
Which seems to relate to this line of code:
function A(e,t,n){return e<t?t:e>n?n:e}class C{static getScreenshotPositions(e,t,n){const r={x:(i=e).left+i.width/2,y:i.top+i.height/2};var i;const o=A(r.x-t.width/2,0,n.width-t.width),a=A(r.y-t.height/2,0,n.height-t.height);return{screenshot:{left:o,top:a},clip:{left:e.left-o,top:e.top-a}}}static renderClipPathInScreenshot(e,t,n,r,i){const o=e.find("clipPath",t),a=`clip-${l.getUniqueSuffix()}`;o.id=a,t.style.clipPath=`url(#${a})`;const s=n.top/i.height,c=s+r.height/i.height,d=n.left/i.width,h=d+r.width/i.width,p=[`0,0 1,0 1,${s} 0,${s}`,`0,${c} 1,${c} 1,1 0,1`,`0,${s} ${d},${s} ${d},${c} 0,${c}`,`${h},${s} 1,${s} 1,${c} ${h},${c}`];for(const t of p){const n=e.createElementNS("http://www.w3.org/2000/svg","polygon");n.setAttribute("points",t),o.append(n)}}static installFullPageScreenshot(e,t){e.style.setProperty("--element-screenshot-url",`url(${t.data})`)}static installOverlayFeature(e){const{dom:t,reportEl:n,overlayContainerEl:r,fullPageScreenshot:i}=e,o="lh-screenshot-overlay--enabled";n.classList.contains(o)||(n.classList.add(o),n.addEventListener("click",(e=>{const n=e.target;if(!n)return;const o=n.closest(".lh-node > .lh-element-screenshot");if(!o)return;const a=t.createElement("div","lh-element-screenshot__overlay");r.append(a);const l={width:.95*a.clientWidth,height:.8*a.clientHeight},s={width:Number(o.dataset.rectWidth),height:Number(o.dataset.rectHeight),left:Number(o.dataset.rectLeft),right:Number(o.dataset.rectLeft)+Number(o.dataset.rectWidth),top:Number(o.dataset.rectTop),bottom:Number(o.dataset.rectTop)+Number(o.dataset.rectHeight)},c=C.render(t,i.screenshot,s,l);c?(a.appendChild(c),a.addEventListener("click",(()=>a.remove()))):a.remove()})))}static _computeZoomFactor(e,t){const n={x:t.width/e.width,y:t.height/e.height},r=.75*Math.min(n.x,n.y);return Math.min(1,r)}static render(e,t,n,r){if(!function(e,t){return t.left<=e.width&&0<=t.right&&t.top<=e.height&&0<=t.bottom}(t,n))return null;const i=e.createComponent("elementScreenshot"),o=e.find("div.lh-element-screenshot",i);o.dataset.rectWidth=n.width.toString(),o.dataset.rectHeight=n.height.toString(),o.dataset.rectLeft=n.left.toString(),o.dataset.rectTop=n.top.toString();const a=this._computeZoomFactor(n,r),l={width:r.width/a,height:r.height/a};l.width=Math.min(t.width,l.width);const s=l.width*a,c=l.height*a,d=C.getScreenshotPositions(n,l,{width:t.width,height:t.height});e.find("div.lh-element-screenshot__content",o).style.top=`-${c}px`;const h=e.find("div.lh-element-screenshot__image",o);h.style.width=s+"px",h.style.height=c+"px",h.style.backgroundPositionY=-d.screenshot.top*a+"px",h.style.backgroundPositionX=-d.screenshot.left*a+"px",h.style.backgroundSize=`${t.width*a}px ${t.height*a}px`;const p=e.find("div.lh-element-screenshot__element-marker",o);p.style.width=n.width*a+"px",p.style.height=n.height*a+"px",p.style.left=d.clip.left*a+"px",p.style.top=d.clip.top*a+"px";const u=e.find("div.lh-element-screenshot__mask",o);return u.style.width=s+"px",u.style.height=c+"px",C.renderClipPathInScreenshot(e,u,d.clip,n,l),o}}
Meaning is probably related to the screenshots.
The bug persist even if I add --screenEmulation.disabled --throttling-method=provided --no-emulatedUserAgent
How do I find the bug stopping the lighthouse from returning an HTML report?

Cypress test passes single form input field but ignores the following one(s)

I’m trying to test a Stripe form with 3 input fields in Cypress. I found an example that works to test a single input that takes all the payment info (https://medium.com/#chipomapondera/hi-michael-98e432948028).
My version passes on inputting the CC but fails on the next input(s). My code is below:
it('checks user can support the Creator', () => {
cy.get('button[class="buttons__FollowButton-sc-10ti9z2-0 huoUmA"]').click()
cy.wait(4000)
cy.get('body')
.should('contain', 'Join this community')
cy.get('button[class="styledComponents__SubscribeButton-g42pit-3 kUgWbq"]').click()
cy.getWithinIframe('[name="cardnumber"]').type('4242424242424242')
.getWithinIframe('[name="exp-date"]').type('1232')
.getWithinIframe('[name="cvc"]').type('987')
})
It doesn’t seem to like the following after it has typed the card number:
cy.getWithinIframe(‘[name=”exp-date”]’).type(‘1232’)
cy.getWithinIframe(‘[name=”cvc”]’).type(‘987’)
The error I receive is:
cypress error
I could see a typo in the type field where there are no ending single quotes at this line of test .getWithinIframe('[name="exp-date"]').type('1232). Could you please try following .getWithinIframe('[name="exp-date"]').type('1232') or may be try without quotes .getWithinIframe('[name="exp-date"]').type(1232)
I followed the medium article you shared and ran into the same issue as you. The cause of this problem is of course that stripe is creating multiple iframes and the method created in the article is just getting the first iframe.
So a very simple solution is to pass the id of the div containing the iframe to our getWithinIframe function. The function will now look like this:
Cypress.Commands.add('getWithinIframe', (iframeSelector, targetElement) =>
cy.get(`#${iframeSelector} iframe`).iframeLoaded().its('document').getInDocument(targetElement));
And call it like so:
cy.getWithinIframe('cardNumberElement','[name="cardnumber"]').type(1212123);
Hope this helps anybody who is facing the same issues.

A null reference or invalid value was found [GDI+ status: InvalidParameter]

I am running an MVC3 app on Mono/linux and everything is working fine with the exception of an image upload utility. Whenever an image upload is attempted i get the Invalid Parameter error from within the method below:
System.Drawing.GDIPlus.CheckStatus(status As Status) (unknown file): N 00339
System.Drawing.Bitmap.SetResolution(xDpi As Single, yDpi As Single)
I've googled this error extensively and have found that the Invalid parameter error can often be misleading, and could fire if for example there was an error with the upload itself, or if the image was not fully read. This runs fine on IIS/Windows, but I've not been able to get it to work in Mono.
Apache2
Mono 2.10.8.1
Am i missing something simple or do i need to find a different way to handle image manipulation for mono?
After doing quite a bit of testing, I was able to determine the root of my error. I was attempting to use the Image.HorizontalResolution and Image.VerticalResolution properties for Bitmap.Resolution . While these properties were set on the initial upload (where the file is read into a stream from the tmp directory), when i posted back with the base64 encoded string of the image itself, it appears these values were lost somehow. Because of this the SetResolution method failed.
For whatever reason i do not have this issue on IIS/Windows, the properties exist in both circumstances.
I encountered a similar issue. A Bitmap loaded from disk, reported bmp.HorizontalResolution==0 and bmp.VerticalResolution==0 when they were both==300. This behaviour does not occur on Windows.
A bit more digging, I found that the following test fails:
[Test]
public void GDI_SetResoltion()
{
var b1 = new Bitmap (100, 100);
Assert.That (b1.HorizontalResolution, Is.Not.EqualTo (0));
Assert.That (b1.VerticalResolution, Is.Not.EqualTo (0));
}
I believe Windows will default resolution to 96 dpi.

Dojo SyntaxError: missing ) in parenthetical

I have had this same error before and posted a question to that effect but unfortunately there was no answer. The previous error occurred under different circumstances ( ie I was triggered when I used the dojo toolkit sdk(Size 19M).
This time I am retrieving data from a couple of tables which have a one to many relationship. I am using Dojo, Doctrine and Zend Framework for my project. I have posted quite an extensive error message at 1 the Link to pastie.org with code and error details and the php and javascript that I identified as being the code involved.
When you look towards the end of the pastie in the FIREBUG ERROR MESSAGE section you will see a piece of JSON like
[{"id":"000001",
"name":"Adam",
"area_id":null,
"registration_date":"2011-03-08",
"loan_cycle":"0","credit_score":"100",
"created_by":null,
"borrowers":[{"id":"00000001",
"first_name":"Test",
"surname":"User",
"dob":"2006-12-09",
"personalid_no":"100000",
"gender":"Male",
"marital_status":"Marrie",
"home_number":"09866678",
"mobile_number":"09877655",
"accomodation_type":"owner",
"current_loan_cycle":"1",
"status":"Active",
"date_created":null,
"date_registered":"2009-12-11",
"created_by":null,
"Groups_id":"000001"}]
}]
Its clear that the data gets pulled from the tables. However the code fails and I get the error message SyntaxError: missing ) in parenthetical. I have battled with this for a long time now. Am at a point where I either have to abandon the application or restart the whole project again. Thanks for your help.

Resources